Re: ::date cast error

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jan Stavárek <jan(dot)stavarek(at)email(dot)cz>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: ::date cast error
Date: 2014-03-31 13:38:19
Message-ID: CAFj8pRCeeH+Mkd=aJOr_SvQzC99V_Mv6VGWs-Mz=4XA1nhCsVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello

2014-03-31 14:15 GMT+02:00 Jan Stavárek <jan(dot)stavarek(at)email(dot)cz>:

> Hello,
>
> I think I might have come accross a bug.
>
>
> Having following table:
>
>
> CREATE TABLE general.materialtransaction
> (
> type integer NOT NULL,
> articleid integer NOT NULL,
> date timestamp without time zone NOT NULL,
> personid integer NOT NULL,
> note text,
> id serial NOT NULL,
> CONSTRAINT materialtransaction_pkey PRIMARY KEY (id),
> CONSTRAINT fk_personid FOREIGN KEY (personid)
> REFERENCES general.person (id) MATCH SIMPLE
> ON UPDATE NO ACTION ON DELETE NO ACTION
> )
>
>
> both queries
>
>
> SELECT Date FROM General.MaterialTransaction WHERE Date::date =
> '2014-03-30'
>
>
> and
>
>
> SELECT Date FROM General.MaterialTransaction WHERE CAST(Date AS date) =
> '2014-03-30'
>
>
> work well in pgAdmin, but on only the second one works in my application
> (using C#, 4.0 .NET Framework and NpqSql). The first one emits a "syntax
> error at or near ":" error in the application. I'm using the latest
> versions of both
>
PostgreSQL and Npqsql.
>
>
> It is looking like Npgsql issue related to unhappy named column "date" -
it is not keyword, but it is datatype name.

> I will also let know the NpqSql team about this issue as I'm not really
> sure where the root cause might be. Maybe it is my fault, but the behaviour
> seems odd to me. At this moment it is not a critical issue for me, since I
> can use the second approach, but I wanted you to know about it.
>
>
>

if you can help - try to write some small test case and send it to Npgsql
team, please

Important info should be in your postgresql log. The broken query should be
logged there - and should be interesting what query was sent to server.
Please, attach related part of log to your test case.

Also, since this is my first e-mail to you, I would like to thank you (the
> whole team) for all the efford you put into PostgreSQL. I'm happy that
> something like this exists!
>

Thank you very much, we are proud so we have happy users.

Regards

Pavel Stehule

>
> Best Regards,
>
> Jan Stavarek
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2014-03-31 15:07:06 Re: BUG #9776: well formed json with embedd colon ':' causes error on copy
Previous Message Jan Stavárek 2014-03-31 12:15:30 ::date cast error