Re: [COMMITTERS] pgsql: Add STRICT to PL/pgSQL SELECT INTO, so exceptions are thrown if

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [COMMITTERS] pgsql: Add STRICT to PL/pgSQL SELECT INTO, so exceptions are thrown if
Date: 2006-06-16 20:06:46
Message-ID: 366.1150488406@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Tom Lane wrote:
>> Do we actually need different error codes for too few and too many rows?
>> It looks to me like the only relevant standard error condition is
>> CARDINALITY_VIOLATION, so either we throw CARDINALITY_VIOLATION for both
>> cases or we invent nonstandard codes.

> We could, and then suggest using ROW_COUNT to determine if there were
> too few rows, or too many.

SELECT INTO doesn't set ROW_COUNT ... but if we change the code to set
FOUND before throwing the error, it'd work to tell people to check
FOUND.

(Thinks a bit...) Actually not, because if the exception catcher isn't
in the same function as the SELECT INTO, it'll be looking at the wrong
FOUND variable. ROW_COUNT same problem, even if we were setting it.

Plan B is to invent new errcodes to match the Oracle spellings. If
that's what we want to do, it's not that hard.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2006-06-16 20:23:45 pgsql: DROP ...
Previous Message Bruce Momjian 2006-06-16 19:49:50 pgsql: Add URL for currency type: >

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2006-06-16 20:08:57 Re: table/index fillfactor control, try 2
Previous Message Bruce Momjian 2006-06-16 20:00:58 Re: libpq Describe Extension [WAS: Bytea and perl]