Re: Why does the PL/pgSQL compiler do this?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Michael Moore <michaeljmoore(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, postgres list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Why does the PL/pgSQL compiler do this?
Date: 2016-11-02 22:15:27
Message-ID: CAFj8pRB59xn7NayMk-x0n-XR9OuNUsnCoNbkkJ21xFn0btJCVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2016-11-01 18:43 GMT+01:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

>
>
> 2016-11-01 18:36 GMT+01:00 Michael Moore <michaeljmoore(at)gmail(dot)com>:
>
>> Hi Tom,
>> understood. If anybody needs a tiny bit of motivation to write that extra
>> bit of code which would complain at compile time: I sense that there are a
>> lot of shops like mine who would love to get off of Oracle due to the cost.
>> That means you'll have guys like myself who are well versed on Oracle's
>> PL/SQL trying to write PL/pgSQL functions. If ROLLBACK; were to cause a
>> syntax error, it would immediately tell guys like myself that we are
>> missing a key concept of how PL/pgSQL works. Saving the error until run
>> time makes look for other reasons that ROLLBACK; might not be working. I
>> know it's a trivial point, but just putting it out there.
>>
>
> This issue can be checked simply by plpgsql_check in next version.
>

tested by
https://github.com/okbob/plpgsql_check/commit/1d3d2f5c853077b9b11a2aad9ad8986c06bee0af
commit.

Regards

Pavel

>
> Regards
>
> Pavel
>
>
>
>
>>
>> Thanks everybody for the enlightening conversation!
>>
>> Regards,
>> Mike
>>
>>
>> On Mon, Oct 31, 2016 at 7:38 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>
>>> Michael Moore <michaeljmoore(at)gmail(dot)com> writes:
>>> > I'm still a bit confused. If I replace the ROLLBACK; command with
>>> ELEPHANT;
>>> > the result is a syntax error. Why doesn't ROLLBACK; produce the same
>>> error
>>> > since it is not valid in the LANGUAGE plpgsql.
>>>
>>> That's a runtime error so far as plpgsql is concerned, because it relies
>>> on the SPI layer to throw the error. It might be practical to complain
>>> about it at compile time, but it would be some extra code that nobody's
>>> written.
>>>
>>> regards, tom lane
>>>
>>
>>
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message David G. Johnston 2016-11-02 22:28:32 Re: ERROR: out of shared memory
Previous Message Michael Moore 2016-11-02 22:03:13 Re: ERROR: out of shared memory