Re: [HACKERS] time stops within transaction

2000-10-19 Thread Hiroshi Inoue
Vadim Mikheev wrote: > > I am inclined to think that we should do SetQuerySnapshot in the outer > > loop of pg_exec_query_string, just before calling > > pg_analyze_and_rewrite. This would ensure that parse/plan accesses to >^^ > Actually

RE: [HACKERS] time stops within transaction

2000-10-19 Thread Hiroshi Inoue
> -Original Message- > From: Tom Lane [mailto:[EMAIL PROTECTED]] > > > > I just remembered a report from Forest Wilkinson > > about a month ago [SQL] SQL functions not locking > > properly? > > Yes, that was on my to-look-at list too. Not sure if it's related. > As I replied to his po

Re: [HACKERS] time stops within transaction

2000-10-19 Thread Vadim Mikheev
> I am inclined to think that we should do SetQuerySnapshot in the outer > loop of pg_exec_query_string, just before calling > pg_analyze_and_rewrite. This would ensure that parse/plan accesses to ^^ Actually not - snapshot is passed as param

Re: [HACKERS] time stops within transaction

2000-10-19 Thread Vadim Mikheev
> > > Snapshot is made per top-level statement and functions/subqueries > > > use the same snapshot as that of top-level statement. > > > > Not so. SetQuerySnapshot is executed per querytree, not per top-level > > statement --- for example, if a rule generates multiple queries from > > a user stat

Re: [HACKERS] time stops within transaction

2000-10-19 Thread Tom Lane
Hiroshi Inoue <[EMAIL PROTECTED]> writes: > Is it possible that a rule generates multiple queries from > a read(select)-only statement ? If so,the queries must > be executed under the same snapshot in order to guaran > tee read consistency from user's POV. > As for non-select queries I'm not sure

Re: [HACKERS] time stops within transaction

2000-10-19 Thread Mikheev, Vadim
> > > Snapshot is made per top-level statement and functions/subqueries > > > use the same snapshot as that of top-level statement. > > > > Not so. SetQuerySnapshot is executed per querytree, not per top-level > > statement --- for example, if a rule generates multiple queries from > > a user sta

Re: [HACKERS] time stops within transaction

2000-10-19 Thread Hiroshi Inoue
Tom Lane wrote: > Hiroshi Inoue <[EMAIL PROTECTED]> writes: > Postgres doesn't have an idea of what a 'top-level' statement is? I.E. > statement as submitted by a client (libpq)? > >> > >> There's never been any reason to make such a distinction. > > > There's already a distinction. >

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Hiroshi Inoue
Tom Lane wrote: > Hiroshi Inoue <[EMAIL PROTECTED]> writes: > Postgres doesn't have an idea of what a 'top-level' statement is? I.E. > statement as submitted by a client (libpq)? > >> > >> There's never been any reason to make such a distinction. > > > There's already a distinction. >

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Tom Lane
Hiroshi Inoue <[EMAIL PROTECTED]> writes: Postgres doesn't have an idea of what a 'top-level' statement is? I.E. statement as submitted by a client (libpq)? >> >> There's never been any reason to make such a distinction. > There's already a distinction. > Snapshot is made per top-level

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Hiroshi Inoue
Tom Lane wrote: > Alex Pilosov <[EMAIL PROTECTED]> writes: > >> Consider statement boundaries in an SQL function --- the > >> function is probably being called from some outer statement, so > >> advancing now() within the function would violate the spec constraint > >> with respect to the outer

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Tom Lane
Alex Pilosov <[EMAIL PROTECTED]> writes: >> Consider statement boundaries in an SQL function --- the >> function is probably being called from some outer statement, so >> advancing now() within the function would violate the spec constraint >> with respect to the outer statement. > Postgres doesn'

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Alex Pilosov
On Wed, 18 Oct 2000, Tom Lane wrote: > I think what you are advocating is recomputing now() at each statement > boundary within a transaction, but that's not as simple as it looks > either. Consider statement boundaries in an SQL function --- the > function is probably being called from some out

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Don Baccus
At 12:39 PM 10/18/00 -0400, Tom Lane wrote: >Peter Eisentraut <[EMAIL PROTECTED]> writes: >> Tom Lane writes: >>> Au contraire, if it did not behave that way it would violate the spec. >>> See SQL92 6.8 general rule 3: >>> >>> 3) If an SQL-statement generally contains more than one reference >>>

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Peter Eisentraut
Tom Lane writes: > So? It also says that the choice of exactly when to evaluate now() > is implementation-dependent. Doing so at start of transaction is > an allowed behavior AFAICS. But it's only talking about statements. You can't reuse things that you calculated for previous statements unl

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Tom Lane writes: >> Au contraire, if it did not behave that way it would violate the spec. >> See SQL92 6.8 general rule 3: >> >> 3) If an SQL-statement generally contains more than one reference >> to one or more s, then all such ref- >> erences are

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Peter Eisentraut
Tom Lane writes: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > Tom Lane writes: > >> That is what now() is defined to return: transaction start time. > > > Then CURRENT_TIMESTAMP is in violation of SQL. > > Au contraire, if it did not behave that way it would violate the spec. > See SQL92

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Tom Lane writes: >> That is what now() is defined to return: transaction start time. > Then CURRENT_TIMESTAMP is in violation of SQL. Au contraire, if it did not behave that way it would violate the spec. See SQL92 6.8 general rule 3: 3) I

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Peter Eisentraut
Tom Lane writes: > That is what now() is defined to return: transaction start time. > Perhaps the documentation needs improvement... Then CURRENT_TIMESTAMP is in violation of SQL. -- Peter Eisentraut [EMAIL PROTECTED] http://yi.org/peter-e/

Re: [HACKERS] time stops within transaction

2000-10-18 Thread Karel Zak
On Tue, 17 Oct 2000, Alex Pilosov wrote: > I just ran into a strangest thing: within transaction, select now() will > always return time when transaction started. Same happens with select > 'now'::timestamp. It's feature, not bug. IMHO good feature, an example I use it for rows identification

Re: [HACKERS] time stops within transaction

2000-10-17 Thread Tom Lane
"John Huttley" <[EMAIL PROTECTED]> writes: > Documentation on time constants and how to misuse them is weak... You can say that again! Who's up for submitting documentation patches? regards, tom lane

Re: [HACKERS] time stops within transaction

2000-10-17 Thread John Huttley
- Original Message - From: Bruce Momjian <[EMAIL PROTECTED]> To: Alex Pilosov <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, 18 October 2000 16:21 Subject: Re: [HACKERS] time stops within transaction > Wow, that is strange. > > > >

Re: [HACKERS] time stops within transaction

2000-10-17 Thread Tom Lane
Alex Pilosov <[EMAIL PROTECTED]> writes: > I just ran into a strangest thing: within transaction, select now() will > always return time when transaction started. That is what now() is defined to return: transaction start time. Perhaps the documentation needs improvement...

Re: [HACKERS] time stops within transaction

2000-10-17 Thread Bruce Momjian
Wow, that is strange. > I just ran into a strangest thing: within transaction, select now() will > always return time when transaction started. Same happens with select > 'now'::timestamp. > > This is with 7.0. I have not tested it with CVS. > > I am not sure what causes this. I assume that re