Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

From: Garick Hamlin <ghamlin(at)isc(dot)upenn(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial
Date: 2010-01-05 19:37:51
Message-ID: 20100105193751.GF88668@isc.upenn.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Tue, Jan 05, 2010 at 02:02:51PM -0500, Tom Lane wrote:
> Stefan Kaltenbrunner <stefan(at)kaltenbrunner(dot)cc> writes:
> > did that and it seems the problem is in the loop that does:
>
> > foreach my $row (@$data)
> > {
>
> > # To construct fmgroids.h and fmgrtab.c, we need to inspect some
> > # of the individual data fields. Just splitting on whitespace
>
> Huh. It's weird that I don't see a leak in either 5.8.7 or 5.10.1,
> which are the two closest perl versions I have handy here. I think
> this may be a platform-specific Perl bug. Still, it would be nice
> to work around it if we can.
>
> I'm not nearly good enough in Perl to be sure about the semantics
> of this loop. Is it possible that it's changing the global contents
> of the @$data structure, rather than just hacking a local copy of
> each row before pushing some values into @fmgr?
Yes, that is what would happen.
I have not read this script at all but that is how perl works...

$row is an aliased to each scalar in the list '(@$data)'

There is no copying. Copying happens on list assignment,
but not with for/foreach.

If you wanted a copy you need something like:
foreach my $row (@{[ @$data ]}) {

for a shallow copy.

Is that a problem? (I haven't read the script)

Garick

>
> 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-committers by date

  From Date Subject
Next Message Tom Lane 2010-01-05 19:42:03 Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial
Previous Message Tom Lane 2010-01-05 19:31:43 Re: Re: [COMMITTERS] pgsql: Get rid of the need for manual maintenance of the initial

Browse pgsql-hackers by date

  From Date Subject
Next Message Scott Bailey 2010-01-05 19:39:38 Re: Proposal: XML helper functions
Previous Message Dave Page 2010-01-05 19:36:20 Re: libpq naming on Win64