Re: [GENERAL] Problem with perl / postgres

From: Stuart Rison <stuart(at)ludwig(dot)ucl(dot)ac(dot)uk>
To: Chris Bitmead <chris(dot)bitmead(at)bigfoot(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Problem with perl / postgres
Date: 1999-06-17 14:00:15
Message-ID: v04020a00b38ead7a6764@[128.40.242.190]
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Chris,

I don't know why it works in psql but not in perl but I've had problems
casting datetime as date before.

In pg 6.4 the cast fails (and by that I mean it yields an error) if
datetime is NULL. A possible 'workaround' is to double-cast:

select date( abstime( dt ) ) from test1;

Now because your query works in psql but not in perl, I don't think that
casting of NULLs is likely to be the problem but hey, it's worth a shot.

On a final note, I think datetime and date are reserved keywords so it's
probably best to rename your attribute 'datetime' and your synonym 'date'!

HTH,

Stuart.

>I've got this simple query...
>
>SELECT id, title, summary, datetime, datetime::date AS date FROM poll
>WHERE id = ?
>
>which works from psql but fails with "bad parameter" from perl. If I
>take out the "datetime::date AS date" bit it starts working.
>
>Why would a query work in psql but not perl?
>
>--
>Chris Bitmead
>mailto:chris(at)tech(dot)com(dot)au
>http://www.techphoto.org - Photography News, Stuff that Matters

+-------------------------+--------------------------------------+
| Stuart Rison | Ludwig Institute for Cancer Research |
+-------------------------+ 91 Riding House Street |
| Tel. (0171) 878 4041 | London, W1P 8BT, UNITED KINGDOM. |
| Fax. (0171) 878 4040 | stuart(at)ludwig(dot)ucl(dot)ac(dot)uk |
+-------------------------+--------------------------------------+

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Warnock 1999-06-17 14:04:44 6.5 & Unicode
Previous Message Bruce Momjian 1999-06-17 13:36:12 Re: [GENERAL] About bug reports