Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Michael Paesold
Greg Sabino Mullane wrote: To reiterate my opinion, I think the behavior should be the same for interactive and non-interactive sessions. Not only will it prevent nasty surprises, but unless we make a third 'setting', there will be no way to enable this in non-interactive scripts, which is

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Richard Huxton
Michael Paesold wrote: But people (like me for example) will want to enable this behaviour by default. So they (me too) will put the option in .psqlrc. It is then enabled by default. But then many of my scripts will destroy data instead of just erroring out. I just don't see why non-interactive

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Tom Lane
Greg Sabino Mullane [EMAIL PROTECTED] writes: To reiterate my opinion, I think the behavior should be the same for interactive and non-interactive sessions. Not only will it prevent nasty surprises, but unless we make a third 'setting', there will be no way to enable this in non-interactive

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Michael Paesold
Richard Huxton wrote: Michael Paesold wrote: But people (like me for example) will want to enable this behaviour by default. So they (me too) will put the option in .psqlrc. It is then enabled by default. But then many of my scripts will destroy data instead of just erroring out. I just don't

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Tom Lane
Richard Huxton dev@archonet.com writes: Michael Paesold wrote: I just don't see why non-interactive mode does need such a switch because there is no way to check if there was an error. So just put two queries there and hope one will work? DROP TABLE foo; CREATE TABLE foo... Unconvincing.

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Joshua D. Drake
I would far rather see people code explicit markers around statements whose failure can be ignored. That is, a script that needs this behavior ought to look like BEGIN; \begin_ignore_error DROP TABLE foo; \end_ignore_error CREATE ... ...

Re: [HACKERS] [PATCHES] Continue transactions after errors in

2005-04-26 Thread Philip Warner
At 12:28 AM 27/04/2005, Tom Lane wrote: Can you show a plausible use-case for such a thing? A not-uncommon case in other DBs is to handle insert/update code where insert is the most likely result. Not sure if this is relevant to scripts: Begin; ...do stuff... insert into trap duplicate index

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Tom Lane
Philip Warner [EMAIL PROTECTED] writes: Also, the blunder-on-regardless approach is popular in pg_dump, or so I'm told ;-). Sure, but pg_dump scripts don't try to execute as a single transaction. None of this discussion applies to the behavior outside an explicit transaction block.

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Andrew Dunstan
Tom Lane wrote: Richard Huxton dev@archonet.com writes: Michael Paesold wrote: I just don't see why non-interactive mode does need such a switch because there is no way to check if there was an error. So just put two queries there and hope one will work? DROP TABLE foo; CREATE

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Tom Lane
Andrew Dunstan [EMAIL PROTECTED] writes: Tom Lane wrote: I would far rather see people code explicit markers around statements whose failure can be ignored. That is, a script that needs this behavior ought to look like BEGIN; \begin_ignore_error DROP TABLE foo; \end_ignore_error CREATE

Re: [PATCHES] Cleaning up unreferenced table files

2005-04-26 Thread Heikki Linnakangas
On Mon, 25 Apr 2005, Bruce Momjian wrote: Tom Lane wrote: ... I think though that we ought to first consider the question of whether we *want* this functionality. On reflection I'm fairly nervous about the idea of actually deleting anything during startup --- seems like a good recipe for turning

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Andrew Dunstan
Tom Lane wrote: Andrew Dunstan [EMAIL PROTECTED] writes: Tom Lane wrote: I would far rather see people code explicit markers around statements whose failure can be ignored. That is, a script that needs this behavior ought to look like BEGIN; \begin_ignore_error DROP TABLE foo;

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread Tom Lane
Andrew Dunstan [EMAIL PROTECTED] writes: \begin_ignore_error DROP TABLE foo; \end_ignore_error I meant it's a lot to type ;-) Well, that's just a matter of choosing good (ie short) names for the backslash commands. I was trying to be clear rather than proposing names I would actually want

Re: [PATCHES] Cleaning up unreferenced table files

2005-04-26 Thread Heikki Linnakangas
On Tue, 26 Apr 2005, Heikki Linnakangas wrote: On Mon, 25 Apr 2005, Bruce Momjian wrote: ... I guess I am happy with just reporting during startup like the patch does now. Ok. I'll fix the design issues Tom addressed earlier, add documentation, and resubmit. Here you go. The new functionality is

Re: [HACKERS] [PATCHES] Continue transactions after errors in psql

2005-04-26 Thread John DeSoi
On Apr 26, 2005, at 10:35 AM, Tom Lane wrote: Once you've got such an infrastructure, it makes sense to allow an interactive mode that automatically puts such things around each statement. But I can't really see the argument for using such a behavior in a script. Scripts are too stupid. Would

Re: [PATCHES] Cleaning up unreferenced table files

2005-04-26 Thread Tom Lane
Heikki Linnakangas [EMAIL PROTECTED] writes: I feel that crashes that leaves behind stale files are rare. Indeed, and getting more so all the time ... which makes me question the value of doing anything about this at all. regards, tom lane