::date cast error

From: Jan Stavárek <jan(dot)stavarek(at)email(dot)cz>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: ::date cast error
Date: 2014-03-31 12:15:30
Message-ID: Fx0.Zjhj.1sBNZrjT2iA.1JELnY@seznam.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


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.

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.

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!

Best Regards,

Jan Stavarek

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Pavel Stehule 2014-03-31 13:38:19 Re: ::date cast error
Previous Message Samokhin, Dmitry [MNPP Saturn] 2014-03-31 08:15:56 Re: BUG #9756: Inconsistent database after OS restart