Re: PL/pgSQL 2

From: Jan Wieck <jan(at)wi3ck(dot)info>
To: David G Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: PL/pgSQL 2
Date: 2014-09-06 17:11:23
Message-ID: 540B403B.3020204@wi3ck.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/06/2014 12:47 PM, David G Johnston wrote:
> ​If the language, and the system as a whole, was only used by
> perfectionists that do not make errors - and with perfectly clean data -
> this adherence to purity would be acceptable. But the real world is not
> that clean and so enhancing the language to meet the needs of the real
> world is not crippling the language. Begin able to state explicitly
> that the cardinality of the set I get back must be 1, no more and no
> less, doesn't remove the fact that I know I am dealing with a set and
> that I simply want to make an assertion as to its properties so that if
> a bug 3 layers deep into the application causes something other than 1
> row to be affected I know immediately and can invoke the appropriate
> action - throw an error.

As I already mentioned in the other thread, those assertions or checks
do not belong into the PL. If they are desired they should be added to
the main SQL syntax as COMMAND CONSTRAINT like suggested by Hannu.

Your statement is not limited to PL functions. It is just as valid for
NORMAL applications.

However, this would be a proprietary extension that is not covered by
any SQL standard and for that reason alone cannot be the default.

Regards,
Jan

--
Jan Wieck
Senior Software Engineer
http://slony.info

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2014-09-06 17:16:37 Re: proposal: plpgsql - Assert statement
Previous Message David G Johnston 2014-09-06 16:47:13 Re: PL/pgSQL 2