Re: Feature discussion: Should syntax errors abort a transaction?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Feature discussion: Should syntax errors abort a transaction?
Date: 2012-06-19 06:20:57
Message-ID: 4867.1340086857@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Craig Ringer <craig(at)postnewspapers(dot)com(dot)au> writes:
> I've been working in psql a lot recently, and have started to wonder why
> statements with syntax errors or other problems that render them
> unexecutable terminate the transaction.

Well, the obvious reason is that it's hard to tell what the user meant,
so bailing is the safest response.

> I understand why statements that raise errors during their execution
> terminate a transaction,

So you're suggesting that "SELECT 1/0;" should terminate a transaction,
but "SELECT 1//0;" should not? How about "ROLBACK;"? It gets pretty
squishy pretty fast when you try to decide which sorts of errors are
more important than others.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Schwarzer 2012-06-19 06:34:52 Re: How to include Tablefunc as an extension
Previous Message Craig Ringer 2012-06-19 02:32:46 Feature discussion: Should syntax errors abort a transaction?