Re: CURRENT_TIME - Mailing list pgsql-general

From Tom Lane
Subject Re: CURRENT_TIME
Date
Msg-id 15647.1036594276@sss.pgh.pa.us
Whole thread Raw
In response to CURRENT_TIME  (Simeó Reig <simeo@incofisa.com>)
List pgsql-general
=?iso-8859-1?Q?Sime=F3_Reig?= <simeo@incofisa.com> writes:
>         NEW.horaultimamodificacio = CURRENT_TIME(0);

> NOTICE:  Error occurred while executing PL/pgSQL function
> set_fetxa_mod_finca
> NOTICE:  line 6 at assignment
> ERROR:  Bad time external representation '12:46:25+01'

I think it will work if you insert an explicit cast:

        NEW.horaultimamodificacio = CURRENT_TIME(0)::time;

(or use CAST() syntax if you prefer).

In the long run, seems like it would be a good idea for type TIME
WITHOUT TIME ZONE's input converter to accept and ignore a timezone
field, just as type TIMESTAMP WITHOUT TIME ZONE does:

regression=# select '2002-11-06 09:48:40.824687-05'::timestamp;
         timestamp
----------------------------
 2002-11-06 09:48:40.824687
(1 row)

regression=# select '09:48:40.824687-05'::time;
ERROR:  Bad time external representation '09:48:40.824687-05'

Thomas, what do you think --- was this behavior deliberate or an
oversight?

            regards, tom lane

pgsql-general by date:

Previous
From: Tommi Maekitalo
Date:
Subject: Re: pam_pgsql, Postfix, imap and PostgreSQL
Next
From: "Tim McAuley"
Date:
Subject: cursors Vs for loops in pl/pgsql