Re: SELECT INTO Array? - Mailing list pgsql-general

From Sean Davis
Subject Re: SELECT INTO Array?
Date
Msg-id 001b01c53780$aefd13d0$5179f345@WATSON
Whole thread Raw
In response to SELECT INTO Array?  ("Zitan Broth" <zitan@mediasculpt.net>)
List pgsql-general
----- Original Message -----
From: "Zitan Broth" <zitan@mediasculpt.net>
To: "Michael Fuhr" <mike@fuhr.org>
Cc: <pgsql-general@postgresql.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.
>



pgsql-general by date:

Previous
From: Poul Møller Hansen
Date:
Subject: Loosing connection with the database
Next
From: Hans-Jürgen Schönig
Date:
Subject: Re: [HACKERS] plPHP in core?