Re: plpgsql Difference in behaviour between versions?

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: pgsql(dot)general(at)googlegroups(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpgsql Difference in behaviour between versions?
Date: 2011-11-23 21:35:33
Message-ID: CAFj8pRAMu8dwhK_cBuwm7VNuFrrYeJ2RHQJG68_6wA71zAPD2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

http://developer.postgresql.org/pgdocs/postgres/release-9-0.html

PL/pgSQL no longer allows variable names that match certain reserved
words (Tom Lane)

use double quotes

rec."open" = 32;

Regards

Pavel Stehule

2011/11/23 Chris McDonald <chrisjonmcdonald(at)gmail(dot)com>:
> Hi,
> I am upgrading a system from postgresql 8.4.8 (fedora 13 x64) to postgresql 9.0.5 (fedora 15 x64). As I build a database I've noticed that the following works on 8.4.8 but does not work on 9.0.5. Can someone tell me why this is not legal syntax in 9.0.5 but is legal in 8.4.8 please:
>
> ===snip===
> create type mytype
> as
> (
>   somekey integer,
>   open numeric(14, 2)
> );
>
> CREATE OR REPLACE FUNCTION myfunc(IN INTEGER, IN NUMERIC(14, 2))
>        RETURNS VOID
> AS $$
> DECLARE
>        somekey ALIAS FOR $1;
>        rec mytype;
> BEGIN
>        rec.somekey = somekey;
>
>        -- 9.0.5 will fail at the dot character in the
>        -- following line here with syntax error sqlstate 42601
>        -- but 8.4.8 is happy.
>        rec.open = 32;
>        -- ^
>
>        RETURN;
> END;
> $$ LANGUAGE plpgsql;
> ===snip===
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jerry Sievers 2011-11-23 21:42:58 Re: plpgsql Difference in behaviour between versions?
Previous Message Rich Shepard 2011-11-23 20:59:58 Re: Blank Numeric Column For INSERT