From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Matt Miller <mattm(at)epx(dot)com> |
Cc: | pgsql-patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: PL/pgSQL: SELECT INTO EXACT |
Date: | 2005-07-30 04:24:25 |
Message-ID: | 200507300424.j6U4OPW22653@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Sorry, patch removed from the queue. I now see the later discussion.
---------------------------------------------------------------------------
Matt Miller wrote:
> This patch implements an optional EXACT keyword after the INTO keyword
> of the PL/pgSQL SELECT INTO command. The motivation is to come closer
> to Oracle's SELECT INTO behavior: when SELECTing INTO scalar targets,
> raise an exception and leave the targets untouched if the query does not
> return exactly one row. This patch does not go so far as to raise an
> exception, but it can simplify porting efforts from PL/SQL. I also feel
> that this EXACT behavior is overall a bit cleaner than the current
> PL/pgSQL behavior. Maybe I've just been brainwashed by years of
> Oracle'ing.
>
> Here are three excerpts from the patched PL/pgSQL documentation:
>
> "If the EXACT option is specified, then target will not be set unless
> the query returns exactly one row"
>
> "You can check the special FOUND variable after a SELECT INTO to
> determine whether the statement was successful. ... an EXACT query is
> successful only if exactly 1 row is returned."
>
> "...GET DIAGNOSTICS (see Section 35.6.6) to retrieve ROW_COUNT. After a
> SELECT INTO EXACT statement ROW_COUNT ... will be equal to 0, 1, or 2,
> indicating no matching rows, exactly one matching row, or greater than
> one matching row, respectively."
[ Attachment, skipping... ]
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Jowett | 2005-07-30 04:36:46 | Re: Implement support for TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL |
Previous Message | Bruce Momjian | 2005-07-30 04:23:57 | Re: PL/pgSQL: SELECT INTO EXACT |
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Jowett | 2005-07-30 04:36:46 | Re: Implement support for TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL |
Previous Message | Bruce Momjian | 2005-07-30 04:23:57 | Re: PL/pgSQL: SELECT INTO EXACT |