[HACKERS] timeout implementation issues

2002-04-23 Thread Nicolas Bazin
I also want to implement the same feature but for ecpg. On  INFORMIX there is the following syntax to control timeouts: SET LOCK MODE TO [WAIT [seconds] | NO WAIT]   There is 2 possibilities: - either the pre-processor implements execution of the statement with the asynchronous functions. T

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Hiroshi Inoue
Michael Loftis wrote: > > Hiroshi Inoue wrote: > > >Tom Lane wrote: > > > >>Hiroshi Inoue <[EMAIL PROTECTED]> writes: > >> > >>>I don't think this is *all* *should be* or *all > >>>or nothing* kind of thing. If a SET variable has > >>>its reason, it would behave in its own right. > >>> > >>Well,

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Michael Loftis
Hiroshi Inoue wrote: >Tom Lane wrote: > >>Hiroshi Inoue <[EMAIL PROTECTED]> writes: >> >>>I don't think this is *all* *should be* or *all >>>or nothing* kind of thing. If a SET variable has >>>its reason, it would behave in its own right. >>> >>Well, we could provide some kind of escape hatch t

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Hiroshi Inoue
Tom Lane wrote: > > Hiroshi Inoue <[EMAIL PROTECTED]> writes: > > I don't think this is *all* *should be* or *all > > or nothing* kind of thing. If a SET variable has > > its reason, it would behave in its own right. > > Well, we could provide some kind of escape hatch to let the behavior > vary

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Tom Lane
Hiroshi Inoue <[EMAIL PROTECTED]> writes: > I don't think this is *all* *should be* or *all > or nothing* kind of thing. If a SET variable has > its reason, it would behave in its own right. Well, we could provide some kind of escape hatch to let the behavior vary from one variable to the next.

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Hiroshi Inoue
Tom Lane wrote: > > Bruce Momjian <[EMAIL PROTECTED]> writes: > > I have updated the TODO to: > > o Abort all or commit all SET changes made in an aborted transaction > > I don't think our current behavior is defended by anyone. > > Hiroshi seems to like it ... Probably I don't love it. Hone

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > I have updated the TODO to: > > o Abort all or commit all SET changes made in an aborted transaction > > I don't think our current behavior is defended by anyone. > > Hiroshi seems to like it ... > > However, "commit SETs ev

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > I have updated the TODO to: > o Abort all or commit all SET changes made in an aborted transaction > I don't think our current behavior is defended by anyone. Hiroshi seems to like it ... However, "commit SETs even after an error" is most certa

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > I have added this to the TODO list, with a question mark. Hope this is > > OK with everyone. > > > o Abort SET changes made in aborted transactions (?) > > Actually, I was planning to make only search_path act that way, bec

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Bruce Momjian
Hiroshi Inoue wrote: > Michael Loftis wrote: > > > > Tom Lane wrote: > > > > >Bruce Momjian <[EMAIL PROTECTED]> writes: > > > > > >>I have added this to the TODO list, with a question mark. Hope this is > > >>OK with everyone. > > >> > > > > > >>o Abort SET changes made in aborted trans

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Hiroshi Inoue
Michael Loftis wrote: > > Tom Lane wrote: > > >Bruce Momjian <[EMAIL PROTECTED]> writes: > > > >>I have added this to the TODO list, with a question mark. Hope this is > >>OK with everyone. > >> > > > >>o Abort SET changes made in aborted transactions (?) > >> > > > >Actually, I was plan

Re: [HACKERS] timeout implementation issues

2002-04-18 Thread Michael Loftis
Tom Lane wrote: >Bruce Momjian <[EMAIL PROTECTED]> writes: > >>I have added this to the TODO list, with a question mark. Hope this is >>OK with everyone. >> > >>o Abort SET changes made in aborted transactions (?) >> > >Actually, I was planning to make only search_path act that way, be

Re: [HACKERS] timeout implementation issues

2002-04-17 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > I have added this to the TODO list, with a question mark. Hope this is > OK with everyone. > o Abort SET changes made in aborted transactions (?) Actually, I was planning to make only search_path act that way, because of all the push-back I'd

Re: [HACKERS] timeout implementation issues

2002-04-17 Thread Bruce Momjian
I have added this to the TODO list, with a question mark. Hope this is OK with everyone. o Abort SET changes made in aborted transactions (?) --- Tom Lane wrote: > Thomas Lockhart <[EMAIL PROTECTED]> writes: > > I

Re: [HACKERS] timeout implementation issues

2002-04-10 Thread Peter Eisentraut
Thomas Lockhart writes: > 1) All commands starting with "SET" must have the same transactional > semantics. I'll agree that it might be nice for consistancy, but imho is > not absolutely required. This rule is already violated anyway. SET TRANSACTION ISOLATION, SET CONSTRAINTS, SET SESSION AUTH

Re: [HACKERS] timeout implementation issues

2002-04-10 Thread Tom Lane
Thomas Lockhart <[EMAIL PROTECTED]> writes: > I do have a concern about how to implement some of the SET commands if > we *do* respect transactional semantics. For example, SET TIME ZONE > saves the current value of an environment variable (if available), and > would need *at least* a "before tran

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Thomas Lockhart
... > Please note that even in those other databases, if one replaces the > COMMIT with ROLLBACK in the above scenario, the effects of the INSERT > *will* roll back. Transpose this into current Postgres, and replace > INSERT with SET, and the effects do *not* roll back. How is that a > good idea

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Actually, we could probably prevent transaction abort on syntax(yacc) > errors, but the other errors like mistyped table names would be hard to > prevent a rollback, so I guess we just roll back on any error. I don't think that what we categorize as an

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > In the case of: > BEGIN WORK; > SET x=1; > bad query that aborts transaction; > SET x=2; > COMMIT WORK; > Only the first SET is done, so at the end, x = 1. Perhaps even more to the point: SET x=0; BEGIN;

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Hiroshi Inoue wrote: > > > > ??? What do you mean by > > > >o Some SETs are honored in an aborted transaction (current) > > > > ? > > > > Is the current state different from > > > > o All SETs are honored in an aborted transaction > > > > ? > > > > > > In the ca

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Bruce Momjian
Tom Lane wrote: > Peter Eisentraut <[EMAIL PROTECTED]> writes: > > Take out a database other than PostgreSQL and do > > > BEGIN; -- or whatever they use; might be implicit > > INSERT INTO existing_table ('legal value'); > > barf; > > COMMIT; > > > The INSERT will most likely succeed. The reason

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > Take out a database other than PostgreSQL and do > BEGIN; -- or whatever they use; might be implicit > INSERT INTO existing_table ('legal value'); > barf; > COMMIT; > The INSERT will most likely succeed. The reason is that "barf" does not > modify

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Bruce Momjian
Hiroshi Inoue wrote: > > > ??? What do you mean by > > >o Some SETs are honored in an aborted transaction (current) > > > ? > > > Is the current state different from > > > o All SETs are honored in an aborted transaction > > > ? > > > > In the case of: > > > > BEGIN WORK; > >

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Bruce Momjian
Hiroshi Inoue wrote: > > > ??? What do you mean by > > >o Some SETs are honored in an aborted transaction (current) > > > ? > > > Is the current state different from > > > o All SETs are honored in an aborted transaction > > > ? > > > > In the case of: > > > > BEGIN WORK; > >

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Hiroshi Inoue wrote: > > Bruce Momjian wrote: > > > > > > Hiroshi Inoue wrote: > > > > > > Oops does the first mean rolling back the variables on abort ? > > > > > > If so I made a mistake. The current is better than the second. > > > > > > > > > > The second means all SET

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Bruce Momjian
Hiroshi Inoue wrote: > Bruce Momjian wrote: > > > > Hiroshi Inoue wrote: > > > > > Oops does the first mean rolling back the variables on abort ? > > > > > If so I made a mistake. The current is better than the second. > > > > > > > > The second means all SET's are rolled back on abort. > > > > >

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Hiroshi Inoue wrote: > > > > Oops does the first mean rolling back the variables on abort ? > > > > If so I made a mistake. The current is better than the second. > > > > > > The second means all SET's are rolled back on abort. > > > > I see. > > BTW what varibles are roll

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Bruce Momjian
Hiroshi Inoue wrote: > > > Oops does the first mean rolling back the variables on abort ? > > > If so I made a mistake. The current is better than the second. > > > > The second means all SET's are rolled back on abort. > > I see. > BTW what varibles are rolled back on abort currently ? Current

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Hiroshi Inoue wrote: > > Hiroshi Inoue wrote: > > > > > > Bruce Momjian wrote: > > > > > > > > OK, we have three possibilities: > > > > > > > > o All SETs are honored in an aborted transaction > > > > o No SETs are honored in an aborted transaction > > >

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Bruce Momjian
Hiroshi Inoue wrote: > Hiroshi Inoue wrote: > > > > Bruce Momjian wrote: > > > > > > OK, we have three possibilities: > > > > > > o All SETs are honored in an aborted transaction > > > o No SETs are honored in an aborted transaction > > > o Some SETs are honored in an a

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Hiroshi Inoue
Hiroshi Inoue wrote: > > Bruce Momjian wrote: > > > > OK, we have three possibilities: > > > > o All SETs are honored in an aborted transaction > > o No SETs are honored in an aborted transaction > > o Some SETs are honored in an aborted transaction (current) > > > > I t

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Hiroshi Inoue
Tom Lane wrote: > > Karel Zak <[EMAIL PROTECTED]> writes: > > It's good point. Why not make it more transparent? You want > > encapsulate it to standard and current SET statement, but if it's > > something different why not use for it different statement? > > > SET SESSION search_path TO '

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Hiroshi Inoue
Bruce Momjian wrote: > > OK, we have three possibilities: > > o All SETs are honored in an aborted transaction > o No SETs are honored in an aborted transaction > o Some SETs are honored in an aborted transaction (current) > > I think the problem is our current behavio

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Bruce Momjian
Peter Eisentraut wrote: > Michael Loftis writes: > > > I was under the impression that for a transaction either all commands > > succeed or all commands fail, atleast according to everything I've ever > > read. > > That's an urban legend. > > A transaction guarantees (among other things) that a

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Peter Eisentraut
Michael Loftis writes: > I was under the impression that for a transaction either all commands > succeed or all commands fail, atleast according to everything I've ever > read. That's an urban legend. A transaction guarantees (among other things) that all modifications to the database with the

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Tom Lane
Karel Zak <[EMAIL PROTECTED]> writes: > It's good point. Why not make it more transparent? You want > encapsulate it to standard and current SET statement, but if it's > something different why not use for it different statement? > SET SESSION search_path TO 'something'; But a plain SET i

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Michael Loftis
Heh pardon me but... I was under the impression that for a transaction either all commands succeed or all commands fail, atleast according to everything I've ever read. So followign that all SETs done within the scope of a BEGIN/COMMIT pair should only take effect if the whole set finishes, i

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Karel Zak
On Mon, Apr 08, 2002 at 01:03:41PM -0400, Tom Lane wrote: > The search_path case is the main reason why I'm intent on changing > the behavior of SET; without that, I'd just leave well enough alone. Is there more variables like "search_path"? If not, I unsure if one item is good consideration f

Re: [HACKERS] timeout implementation issues

2002-04-09 Thread Karel Zak
On Mon, Apr 08, 2002 at 12:28:18PM -0400, Peter Eisentraut wrote: > Bruce Momjian writes: > > > OK, probably good time for summarization. First, consider this: > > > > BEGIN WORK; > > SET something; > > query fails; > > SET something else; > > COMMIT WORK; > > > > Under curre

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Hiroshi Inoue wrote: > > Yes, if you want multiple timeouts, you clearly could go in that > > direction. Right now, we are considering only single-statement timing > > and no one has asked for multiple timers. > > I don't ask multiple timers. ODBC driver would be able > to handle multiple timeou

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Hiroshi Inoue wrote: > > Bruce Momjian wrote: > > > > > > Hiroshi Inoue wrote: > > > > Bruce Momjian wrote: > > > > > > > > > They want the timeout for only the one statement, so they have to set it > > > > > > > to non-zero before the statement, and to zero after the stat

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Hiroshi Inoue wrote: > Bruce Momjian wrote: > > > > Hiroshi Inoue wrote: > > > Bruce Momjian wrote: > > > > > > > They want the timeout for only the one statement, so they have to set it > > > > > > to non-zero before the statement, and to zero after the statement. > > > > > > > > > > Does setQu

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Hiroshi Inoue wrote: > > Bruce Momjian wrote: > > > > > They want the timeout for only the one statement, so they have to set it > > > > > to non-zero before the statement, and to zero after the statement. > > > > > > > > Does setQueryTimeout() issue a corresponding SET Q

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Hiroshi Inoue wrote: > Bruce Momjian wrote: > > > > Hiroshi Inoue wrote: > > > > > Why should the SET query_timeout = 0 command be issued > > > > > only when the query failed ? Is it a JDBC driver's requirement > > > > > or some applications' requirements which uses the JDBC driver ? > > > > > >

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Hiroshi Inoue wrote: > > > > Why should the SET query_timeout = 0 command be issued > > > > only when the query failed ? Is it a JDBC driver's requirement > > > > or some applications' requirements which uses the JDBC driver ? > > > > > > They want the timeout for only the

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Hiroshi Inoue wrote: > > > Why should the SET query_timeout = 0 command be issued > > > only when the query failed ? Is it a JDBC driver's requirement > > > or some applications' requirements which uses the JDBC driver ? > > > > They want the timeout for only the one statement, so they have to se

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Hiroshi Inoue
Bruce Momjian wrote: > > Hiroshi Inoue wrote: > > > -Original Message- > > > From: Bruce Momjian [mailto:[EMAIL PROTECTED]] > > > > > > > > OK using your example, one by one > > > > > > > > BEGIN WORK; > > > > SET query_timeout=20; > > > > query fails; > > > > SET query_tim

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Hiroshi Inoue wrote: > > -Original Message- > > From: Bruce Momjian [mailto:[EMAIL PROTECTED]] > > > > > > OK using your example, one by one > > > > > > BEGIN WORK; > > > SET query_timeout=20; > > > query fails; > > > SET query_timeout=0; > > > > > > For what the SET was

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Hiroshi Inoue
> -Original Message- > From: Bruce Momjian [mailto:[EMAIL PROTECTED]] > > > > OK using your example, one by one > > > > BEGIN WORK; > > SET query_timeout=20; > > query fails; > > SET query_timeout=0; > > > > For what the SET was issued ? > > What command is issued if the

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Hiroshi Inoue wrote: > > -Original Message- > > From: Bruce Momjian [mailto:[EMAIL PROTECTED]] > > > > Hiroshi Inoue wrote: > > > > I am confused. Above you state you want SET QUERY_TIMEOUT to be > > > > per-query. I assume you mean that the timeout applies for > > only the next > > > >

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Hiroshi Inoue
> -Original Message- > From: Tom Lane [mailto:[EMAIL PROTECTED]] > > "Hiroshi Inoue" <[EMAIL PROTECTED]> writes: > > Sorry for my poor explanation. What I meant is that *Rollback* > > is to >> cancel the changes made to SQL-data or schemas This line is a quote from SQL99 not my creation.

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Hiroshi Inoue
> -Original Message- > From: Bruce Momjian [mailto:[EMAIL PROTECTED]] > > Hiroshi Inoue wrote: > > > I am confused. Above you state you want SET QUERY_TIMEOUT to be > > > per-query. I assume you mean that the timeout applies for > only the next > > > query and is turned off after that.

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: >> But that is not a shortcoming of the SET command. The problem is that the >> system does not accept any commands after one command has failed in a >> transaction even though it could usefully do so. In a situation where the reason for failure was a sy

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Tom Lane
Jan Wieck <[EMAIL PROTECTED]> writes: > If namespace dropping allows for creation of objects that > cannot be dropped afterwards any more, I would call that a > bug or design flaw, which has to be fixed. I will not require schema support to wait upon the existence of dependency

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Tom Lane
"Hiroshi Inoue" <[EMAIL PROTECTED]> writes: > Sorry for my poor explanation. What I meant is that *Rollback* > is to cancel the changes made to SQL-data or schemas > not to put back the variables which are local to the session. Uh, why? Seems to me you are asserting as a given exactly the point

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Peter Eisentraut wrote: > Bruce Momjian writes: > > > OK, probably good time for summarization. First, consider this: > > > > BEGIN WORK; > > SET something; > > query fails; > > SET something else; > > COMMIT WORK; > > > > Under current behavior, the first SET is honored, whi

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Peter Eisentraut
Bruce Momjian writes: > OK, probably good time for summarization. First, consider this: > > BEGIN WORK; > SET something; > query fails; > SET something else; > COMMIT WORK; > > Under current behavior, the first SET is honored, while the second is > ignored because t

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Hiroshi Inoue
> -Original Message- > From: Bruce Momjian [mailto:[EMAIL PROTECTED]] > > Hiroshi Inoue wrote: > > > > > > > > I feel we should just do it. Yeah, there might be some corner cases > > > > where it's not the ideal behavior; but you haven't convinced me that > > > > there are more cases wher

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Jan Wieck
Tom Lane wrote: > Jan Wieck <[EMAIL PROTECTED]> writes: > > Is an invalid search path really that critical (read security > > issue)? > > It's not a security issue (unless the OID counter wraps around soon > enough to let someone else get assigned the same OID for a namespace). > But it co

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Hiroshi Inoue wrote: > > > I vote against you. If a variable is local to the session, you > > > can change it as you like without bothering any other user(session). > > > Automatic resetting of the varibales is rather confusing to me. > > > > I don't see how this relates to other users. All SET c

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Thomas Lockhart wrote: > > > I consider SET variables metadata that are not affected by transactions. > > Why? Again, the fact that historically they've not acted that way isn't > > sufficient reason for me. > > Hmm. Historically, SET controls behaviors *out of band* with the normal > transactio

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Thomas Lockhart
> > I consider SET variables metadata that are not affected by transactions. > Why? Again, the fact that historically they've not acted that way isn't > sufficient reason for me. Hmm. Historically, SET controls behaviors *out of band* with the normal transaction mechanisms. There is strong prece

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Jan Wieck wrote: > > > Psql and libpq would simply issue the query according to the > > > user's request as they currently do. What's pain with it ? > > > > If they wanted to place a timeout on all queries in a session, they > > would need a SET for every query, which seems like a pain. > > E

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Tom Lane wrote: > This does not work as intended if the initial SET doesn't roll back > upon transaction failure. Yeah, you can restructure it to > > SET enable_seqscan = false; > BEGIN; > some-queries-that-might-fail; > END; > SET enable_seqscan = true; > > but wh

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Tom Lane
Jan Wieck <[EMAIL PROTECTED]> writes: > Is an invalid search path really that critical (read security > issue)? It's not a security issue (unless the OID counter wraps around soon enough to let someone else get assigned the same OID for a namespace). But it could be pretty annoying anyway

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Jan Wieck
Tom Lane wrote: > Karel Zak <[EMAIL PROTECTED]> writes: > > Is there some problem implement "SET ... ON ROLLBACK UNSET" ? > > Yes. See my previous example concerning search_path: that variable > MUST be rolled back at transaction abort, else we risk its value being > invalid. We cannot offer th

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Jan Wieck
Bruce Momjian wrote: > > > > Sorry I couldn't understand your point. > > > > It seems the simplest and the most certain way is to call > > > > 'SET QUERY_TIMEOUT per query. The way dosen't require > > > > RESET at all. Is the overhead an issue ? > > > > > > What about psql and libpq. Doing a tim

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Tom Lane
Karel Zak <[EMAIL PROTECTED]> writes: > Is there some problem implement "SET ... ON ROLLBACK UNSET" ? Yes. See my previous example concerning search_path: that variable MUST be rolled back at transaction abort, else we risk its value being invalid. We cannot offer the user a choice. So far I

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Karel Zak wrote: > I agree with Peter. For example I have multi-encoding client program > that changing client-encoding in the middle of transaction and this > change not depend on transaction. And the other thing: I have DB > driver in an program there is not possible do SQL query outsite >

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Bruce Momjian
Hiroshi Inoue wrote: > > I am confused. Above you state you want SET QUERY_TIMEOUT to be > > per-query. I assume you mean that the timeout applies for only the next > > query and is turned off after that. > > Hmm there seems a misunderstanding between you and I but I > don't see what it is. Does

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Hiroshi Inoue
> -Original Message- > From: Bruce Momjian [mailto:[EMAIL PROTECTED]] > > Hiroshi Inoue wrote: > > Bruce Momjian wrote: > > > > > > > > > Sorry I couldn't understand your point. > > > > > > It seems the simplest and the most certain way is to call > > > > > > 'SET QUERY_TIMEOUT per query

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Karel Zak
On Sun, Apr 07, 2002 at 01:01:07AM -0500, Peter Eisentraut wrote: > Tom Lane writes: > > > I didn't say "transaction specific". I said that if you do a SET inside > > a transaction block, and then the transaction is aborted, the effects of > > the SET ought to roll back along with everything els

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Karel Zak
On Fri, Apr 05, 2002 at 02:13:26PM -0500, Tom Lane wrote: > It seems clear to me that SET *should* roll back on abort. Just a > matter of how important is it to fix. I want control on this :-) SET valname = 'vatdata' ON ROLLBACK UNSET; or SET valname = 'vatdata';

Re: [HACKERS] timeout implementation issues

2002-04-08 Thread Karel Zak
On Fri, Apr 05, 2002 at 08:32:47PM -0500, Bruce Momjian wrote: > > Or, as I suggested above, extend the SELECT (and other querys?) syntax > > seems reasonable. More so than the non-standard 'use this index, really' > > types of extensions that other RDBMSs provide, that we've rightly avoided. > >

Re: [HACKERS] timeout implementation issues

2002-04-07 Thread Thomas Swan
Bruce Momjian wrote: Hiroshi Inoue wrote: Bruce Momjian wrote: I guess it's a matter of definition: Do you consider SET variablesdatabase state or session metadata? I think some are this and some arethat. I'm not sure how to draw the line, but throwing

Re: [HACKERS] timeout implementation issues

2002-04-07 Thread Bruce Momjian
Hiroshi Inoue wrote: > Bruce Momjian wrote: > > > > > > > Sorry I couldn't understand your point. > > > > > It seems the simplest and the most certain way is to call > > > > > 'SET QUERY_TIMEOUT per query. The way dosen't require > > > > > RESET at all. Is the overhead an issue ? > > > > > > > >

Re: [HACKERS] timeout implementation issues

2002-04-07 Thread Bruce Momjian
Hiroshi Inoue wrote: > Bruce Momjian wrote: > > > > > > I guess it's a matter of definition: Do you consider SET variables > > > > database state or session metadata? I think some are this and some are > > > > that. I'm not sure how to draw the line, but throwing everything from one > > > > cat

Re: [HACKERS] timeout implementation issues

2002-04-07 Thread Hiroshi Inoue
Bruce Momjian wrote: > > > > > Sorry I couldn't understand your point. > > > > It seems the simplest and the most certain way is to call > > > > 'SET QUERY_TIMEOUT per query. The way dosen't require > > > > RESET at all. Is the overhead an issue ? > > > > > > What about psql and libpq. Doing a t

Re: [HACKERS] timeout implementation issues

2002-04-07 Thread Hiroshi Inoue
Bruce Momjian wrote: > > > > I guess it's a matter of definition: Do you consider SET variables > > > database state or session metadata? I think some are this and some are > > > that. I'm not sure how to draw the line, but throwing everything from one > > > category into the other isn't my favo

Re: [HACKERS] timeout implementation issues

2002-04-07 Thread Bruce Momjian
> > > Sorry I couldn't understand your point. > > > It seems the simplest and the most certain way is to call > > > 'SET QUERY_TIMEOUT per query. The way dosen't require > > > RESET at all. Is the overhead an issue ? > > > > What about psql and libpq. Doing a timeout before every query is a > >

Re: [HACKERS] timeout implementation issues

2002-04-07 Thread Hiroshi Inoue
Bruce Momjian wrote: > > > > > Probably I'm misunderstanding this thread. > > > > Why must the query_timeout be reset particularly ? > > > > What's wrong with simply issueing set query_timeout > > > > command just before every query ? > > > > > > You could do that, but we also imagine cases where

Re: [HACKERS] timeout implementation issues

2002-04-07 Thread Bruce Momjian
> > I guess it's a matter of definition: Do you consider SET variables > > database state or session metadata? I think some are this and some are > > that. I'm not sure how to draw the line, but throwing everything from one > > category into the other isn't my favorite solution. > > You seem to

Re: [HACKERS] timeout implementation issues

2002-04-07 Thread Bruce Momjian
> > > Probably I'm misunderstanding this thread. > > > Why must the query_timeout be reset particularly ? > > > What's wrong with simply issueing set query_timeout > > > command just before every query ? > > > > You could do that, but we also imagine cases where people would want to > > set a tim

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Hiroshi Inoue
> -Original Message- > From: Bruce Momjian [mailto:[EMAIL PROTECTED]] > > Hiroshi Inoue wrote: > > > -Original Message- > > > From: Tom Lane > > > > > > Jan Wieck <[EMAIL PROTECTED]> writes: > > > > Could we get out of this by defining that "timeout" is > > > > aut

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Hiroshi Inoue
> -Original Message- > From: Peter Eisentraut [mailto:[EMAIL PROTECTED]] > > > I guess it's a matter of definition: Do you consider SET variables > database state or session metadata? Session metadata IMHO. If there are(would be) database state variables we should introduce another co

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: > I consider SET variables metadata that are not affected by transactions. Why? Again, the fact that historically they've not acted that way isn't sufficient reason for me. > I should be able to change my mind about my session preferences in the > mi

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Peter Eisentraut
Tom Lane writes: > I didn't say "transaction specific". I said that if you do a SET inside > a transaction block, and then the transaction is aborted, the effects of > the SET ought to roll back along with everything else you did inside > that transaction block. I'm not seeing what the argument

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Tom Lane
Peter Eisentraut <[EMAIL PROTECTED]> writes: >> Can we all compromise on that? > No. Oh dear... > I agree that there may be some variables that must be rolled back, or > where automatic reset on transaction end may be desirable (note that these > are two different things), but for some variable

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Peter Eisentraut
Tom Lane writes: > Note: I am now pretty well convinced that we *must* fix SET to roll back > to start-of-transaction settings on transaction abort. If we do that, > at least some of the difficulty disappears for JDBC to handle one-shot > timeouts by issuing SETs before and after the target quer

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Barry Lind
Tom Lane wrote: > Note: I am now pretty well convinced that we *must* fix SET to roll back > to start-of-transaction settings on transaction abort. If we do that, > at least some of the difficulty disappears for JDBC to handle one-shot > timeouts by issuing SETs before and after the target query

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Ewe, I was hoping for something with zero overhead for the non-SET case. > > Well, a function call and immediate return if no SET has been executed > in the current xact seems low enough overhead to me. We'll just keep > a flag show

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > Ewe, I was hoping for something with zero overhead for the non-SET case. Well, a function call and immediate return if no SET has been executed in the current xact seems low enough overhead to me. We'll just keep a flag showing whether there's anything

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > We do have on_shmem_exit and on_proc_exit function call queues. Seems > we will need SET to create a queue of function calls containing previous > values of variables SEt in multi-statement transactions. If we execute > the queue in last-in-first-out o

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > We do have on_shmem_exit and on_proc_exit function call queues. Seems > > we will need SET to create a queue of function calls containing previous > > values of variables SEt in multi-statement transactions. If we execute > > the qu

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > >> One approach might be for the interface to take care of setting the query > >> timeout before each query, and just ask the backend to handle timeouts > >> per-query. So from the user's perspective, session-level timeouts would > >> e

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: >> One approach might be for the interface to take care of setting the query >> timeout before each query, and just ask the backend to handle timeouts >> per-query. So from the user's perspective, session-level timeouts would >> exist, but the backend woul

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Bruce Momjian
Jessica Perry Hekman wrote: > On Sat, 6 Apr 2002, Bruce Momjian wrote: > > > > What's wrong with simply issueing set query_timeout > > > command just before every query ? > > > > You could do that, but we also imagine cases where people would want to > > set a timeout for each query in an entire

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Jessica Perry Hekman
On Sat, 6 Apr 2002, Bruce Momjian wrote: > > What's wrong with simply issueing set query_timeout > > command just before every query ? > > You could do that, but we also imagine cases where people would want to > set a timeout for each query in an entire session. One approach might be for the i

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Bruce Momjian
Hiroshi Inoue wrote: > > -Original Message- > > From: Tom Lane > > > > Jan Wieck <[EMAIL PROTECTED]> writes: > > > Could we get out of this by defining that "timeout" is > > > automatically reset at next statement end? > > > > I was hoping to avoid that, because it seems l

Re: [HACKERS] timeout implementation issues

2002-04-06 Thread Hiroshi Inoue
> -Original Message- > From: Tom Lane > > Jan Wieck <[EMAIL PROTECTED]> writes: > > Could we get out of this by defining that "timeout" is > > automatically reset at next statement end? > > I was hoping to avoid that, because it seems like a wart. OTOH, > it'd be less of a

  1   2   >