Re: timestamp/function question

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: timestamp/function question
Date: 2001-03-29 17:13:00
Message-ID: 20010329111300.C25154@mail.serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 28, 2001 at 11:41:28PM -0800, Soma Interesting wrote:
> At 12:41 AM 3/29/2001 -0600, you wrote:
> >do. In the case of logfunc1(), the Postgres main parser knows
> >when preparing the plan for the INSERT, that the string 'now'
> >should be interpreted as datetime because the target field of
> >logtable is of that type. Thus, it will make a constant from it
> >at this time and this constant value is then used in all
> >invocations of logfunc1() during the lifetime of the backend.
> >Needless to say that this isn't what the programmer wanted.
> >
> >In the case of logfunc2(), the Postgres main parser does not know
> >what type 'now' should become and therefor it returns a datatype
> >of text containing the string 'now'. During the assignment to the
> >local variable curtime, the PL/pgSQL interpreter casts this
> >string to the datetime type by calling the text_out() and
> >datetime_in() functions for the conversion.
>
>
> ...and that all meant what? The postgres manual is open to much
> interpretation to anyone new trying to understand its contents. Combine
> that with documentation that's still not written, or broken across several
> different sections (programmer, user, admin, etc) and a search engine which
> returns absolute crap.... well I guess us new users can just go use MySQL.
>
> as far as I can tell the above sounds like a complicated work-around to a
> bug, but maybe you'll be kind enough to correct me on this...?

i'd agree with you.

but as tom lane mentioned, current_date is today, all day, until
midnight (local time zone, i presume) whereas current_timestamp
is less chunky, having finer grains down to one second.

but even there, the timestamp is apparently (just learned this
today from other posts on this thread) set for the start of the
current transaction (or is it session?)...

timeofday() may be what you're after.

try

psql
\df time
\df current

--
does a brain cell think?

will(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2001-03-29 17:25:06 Re: tables, where
Previous Message will trillich 2001-03-29 17:07:50 Re: inconsistent functionality with LIKE operator