Re: Fwd: Re: [GENERAL] timestamp/function question
On Wed, Mar 28, 2001 at 11:46:42PM -0800, Soma Interesting wrote: blah blah blah snip ...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...? BETTER YET! edit my example code so it works and post it to this list so everyone else can have a function that uses ''now'' as actually "this very moment in time", rather than "the moment the main parser made 'now' a constant". Yeesh! try \df time and see what's available. notably, select timeofday(),timenow(); -- does a brain cell think? [EMAIL PROTECTED] http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us! ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
Re: [GENERAL] timestamp/function question
Soma Interesting [EMAIL PROTECTED] writes: Why does the following code return the exact same value each time, instead of a value based on the current time? CREATE FUNCTION memb_num () RETURNS INT4 AS ' BEGIN RETURN date_part(''epoch'', CURRENT_DATE); END; ' LANGUAGE 'plpgsql'; Because you asked for a value based on the current *date*. If you waited till tomorrow and tried again, then you'd get a different answer. Perhaps you want RETURN date_part(''epoch'', CURRENT_TIMESTAMP); regards, tom lane ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [GENERAL] timestamp/function question
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. blah blah blah snip ...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...? ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Fwd: Re: [GENERAL] timestamp/function question
blah blah blah snip ...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...? BETTER YET! edit my example code so it works and post it to this list so everyone else can have a function that uses ''now'' as actually "this very moment in time", rather than "the moment the main parser made 'now' a constant". Yeesh! ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://www.postgresql.org/search.mpl