Thread: pgsql-server/src/pl/plpgsql/src gram.y pl_exec ...

pgsql-server/src/pl/plpgsql/src gram.y pl_exec ...

From
tgl@postgresql.org (Tom Lane)
Date:
CVSROOT:    /cvsroot
Module name:    pgsql-server
Changes by:    tgl@postgresql.org    03/03/24 22:16:41

Modified files:
    src/pl/plpgsql/src: gram.y pl_exec.c pl_funcs.c plpgsql.h

Log message:
    plpgsql can assign to subscripted variables now, e.g.
    x[42] := whatever;
    The facility is pretty primitive because it doesn't do array slicing and
    it has the same semantics as array update in SQL (array must already
    be non-null, etc).  But it's a start.


Re: pgsql-server/src/pl/plpgsql/src gram.y pl_exec ...

From
Joe Conway
Date:
Tom Lane wrote:
> Log message:
>     plpgsql can assign to subscripted variables now, e.g.
>     x[42] := whatever;
>     The facility is pretty primitive because it doesn't do array slicing and
>     it has the same semantics as array update in SQL (array must already
>     be non-null, etc).  But it's a start.

I just started looking at this this afternoon. Of course, it would have
taken me quite a bit longer than you to figure it out, so I'm glad you
did :-)

However, I'm now seeing this:
[root@jec-linux pgsql]# cd /opt/src/pgsql/src/pl/plpgsql/src
[root@jec-linux src]# bison -y -d  gram.y
NONE:0: /usr/bin/m4: ERROR: EOF in string

Is this a "latest bison" kind of issue? I'm using version 1.75.

Thanks,

Joe


Re: pgsql-server/src/pl/plpgsql/src gram.y pl_exec ...

From
Joe Conway
Date:
Joe Conway wrote:
> However, I'm now seeing this:
> [root@jec-linux pgsql]# cd /opt/src/pgsql/src/pl/plpgsql/src
> [root@jec-linux src]# bison -y -d  gram.y
> NONE:0: /usr/bin/m4: ERROR: EOF in string
>
> Is this a "latest bison" kind of issue? I'm using version 1.75.
>

bison version seems to be the case. I updated to bison 1.875 and now
everything works perfectly.

BTW, this change together with the array expression stuff I just sent in
works well together:

CREATE OR REPLACE FUNCTION test1(integer[]) RETURNS float[] AS '
DECLARE
   pa_dsid ALIAS FOR $1;
   l_rv float[];
BEGIN
   -- initialize a 5 element return array
   l_rv := array[0,0,0,0,0];
   FOR aoffset IN 1 .. 5 LOOP
     l_rv[aoffset]:=pa_dsid[aoffset] * 1.33;
   END LOOP;
   RETURN l_rv;
END;
' language 'plpgsql';

regression=# select test1(array[1,2,3,4,5]);
            test1
----------------------------
  {1.33,2.66,3.99,5.32,6.65}
(1 row)

Joe


Re: pgsql-server/src/pl/plpgsql/src gram.y pl_exec ...

From
"Christopher Kings-Lynne"
Date:
> > Is this a "latest bison" kind of issue? I'm using version 1.75.
> >
>
> bison version seems to be the case. I updated to bison 1.875 and now
> everything works perfectly.

Weird - compiles fine for me on FreeBSD/Alpha with 1.75...

Maybe anoncvs hasn't been updated yet...

Chris


Re: pgsql-server/src/pl/plpgsql/src gram.y pl_exec ...

From
Tom Lane
Date:
>>> Is this a "latest bison" kind of issue? I'm using version 1.75.
>>
>> bison version seems to be the case. I updated to bison 1.875 and now
>> everything works perfectly.

> Weird - compiles fine for me on FreeBSD/Alpha with 1.75...

I'm at 1.875 and didn't notice any problem.  Perhaps a machine
dependency had crept into bison 1.75?  Prolly not worth trolling their
logfiles to find out.

If anyone else confirms the failure, though, we'll need to update our
own docs to specify bison >= 1.875 required.  I think it says 1.50
at the moment ...

            regards, tom lane


Re: pgsql-server/src/pl/plpgsql/src gram.y pl_exec ...

From
Alvaro Herrera
Date:
On Tue, Mar 25, 2003 at 09:08:35AM -0500, Tom Lane wrote:
> >>> Is this a "latest bison" kind of issue? I'm using version 1.75.
> >>
> >> bison version seems to be the case. I updated to bison 1.875 and now
> >> everything works perfectly.
>
> > Weird - compiles fine for me on FreeBSD/Alpha with 1.75...
>
> I'm at 1.875 and didn't notice any problem.  Perhaps a machine
> dependency had crept into bison 1.75?  Prolly not worth trolling their
> logfiles to find out.
>
> If anyone else confirms the failure, though, we'll need to update our
> own docs to specify bison >= 1.875 required.  I think it says 1.50
> at the moment ...

I also see the failure with bison 1.75.  This is Linux/ix86.

make[1]: Cambiando a directorio
`/home/alvherre/CVS/pgsql/src/pl/plpgsql/src'
bison -y -d  gram.y
NONE:0: /usr/bin/m4: ERROR: EOF in string

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El sentido de las cosas no viene de las cosas, sino de
las inteligencias que las aplican a sus problemas diarios
en busca del progreso." (Ernesto Hernández-Novich)


Re: pgsql-server/src/pl/plpgsql/src gram.y pl_exec ...

From
Bruce Momjian
Date:
Tom Lane wrote:
> >>> Is this a "latest bison" kind of issue? I'm using version 1.75.
> >>
> >> bison version seems to be the case. I updated to bison 1.875 and now
> >> everything works perfectly.
>
> > Weird - compiles fine for me on FreeBSD/Alpha with 1.75...
>
> I'm at 1.875 and didn't notice any problem.  Perhaps a machine
> dependency had crept into bison 1.75?  Prolly not worth trolling their
> logfiles to find out.

Updating to bison 1.85 fixed the problem.

> If anyone else confirms the failure, though, we'll need to update our
> own docs to specify bison >= 1.875 required.  I think it says 1.50
> at the moment ...

I have updated the documentation.  It isn't worth trying to get 1.75
working.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073