Re: PL/pgSQL support to define multi variables once

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Quan Zongliang <quanzongliang(at)gmail(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/pgSQL support to define multi variables once
Date: 2014-06-13 14:12:36
Message-ID: CAFj8pRCrwgcKKdcwWhxPrW7xU2rU8BfVb-FYJT1Sb1nz16hzrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

We can disallow custom initialization when when variables are declared as
list.

Quan' example is 100% valid in SQL/PSM and what I read about ADA then in
ADA too.

Regards

Pavel

2014-06-13 16:04 GMT+02:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> Quan Zongliang <quanzongliang(at)gmail(dot)com> writes:
> > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$
> > DECLARE
> > local_a, local_b, local_c text := 'a1----';
> > BEGIN
> > return local_a || local_b || local_c;
> > end;
> > $$ LANGUAGE plpgsql;
>
> This does not seem like a terribly good idea from here. The main problem
> with the syntax is that it's very unclear whether the initializer (if any)
> applies to all the variables or just one. C users will probably think
> the latter but your example seems to suggest that you think the former.
> I doubt that this adds so much usefulness that it's worth adding confusion
> too.
>
> regards, tom lane
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-06-13 14:17:14 Re: PL/pgSQL support to define multi variables once
Previous Message Fujii Masao 2014-06-13 14:06:14 Re: Audit of logout