Re: SELECT INTO Array?

From: "Sean Davis" <sdavis2(at)mail(dot)nih(dot)gov>
To: "Zitan Broth" <zitan(at)mediasculpt(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT INTO Array?
Date: 2005-04-02 12:37:07
Message-ID: 001b01c53780$aefd13d0$5179f345@WATSON
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


----- Original Message -----
From: "Zitan Broth" <zitan(at)mediasculpt(dot)net>
To: "Michael Fuhr" <mike(at)fuhr(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Friday, April 01, 2005 9:00 PM
Subject: Re: [GENERAL] SELECT INTO Array?

> Hi Michael,
>
> Good question :-)
>
> I am writing a function that has a row of data passed into it as variables
> and an ID. The function needs to pull out the appropriate row of data and
> compare each data item which those passed in. For each found difference a
> log row is written somewhere else and if there are *any* differences the
> whole row is updated.
>
> I was building an array from the passed in parameters with ||, then I
> wanted
> to build an array from a query (with SELECT INTO) and then compare each
> value with a loop:
>
> FOR i IN 1..17 LOOP
> -- compare current with new data
> if CurrentData[i] is not NewData[i] then
> ChangeFound := true;
> -- load change into log table
>
> Make sense? Thanks again,

I think other folks hinted at this before, but you might consider using
pl/perl or pl/python for this. Array support and manipulation is more
advanced in these languages than in pl/pgsql, at least for manipulation
within the function.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hans-Jürgen Schönig 2005-04-02 15:12:36 Re: [HACKERS] plPHP in core?
Previous Message Poul Møller Hansen 2005-04-02 10:23:21 Loosing connection with the database