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

From Zitan Broth
Subject Re: SELECT INTO Array?
Date
Msg-id 001e01c53727$c8d37280$4701a8c0@GarethsLaptop
Whole thread Raw
In response to SELECT INTO Array?  ("Zitan Broth" <zitan@mediasculpt.net>)
List pgsql-general
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,

G.

----- Original Message -----
From: "Michael Fuhr" <mike@fuhr.org>
To: "Zitan Broth" <zitan@mediasculpt.net>
Cc: <pgsql-general@postgresql.org>
Sent: Saturday, April 02, 2005 12:57 PM
Subject: Re: [GENERAL] SELECT INTO Array?


> On Sat, Apr 02, 2005 at 12:29:15PM +1200, Zitan Broth wrote:
> >
> > Basically I am selecting out "one row" from the database with multiple
> > columns (should have told you that earlier) so it seems that
unfortunately
> > your elegant approach below might not work.  Although some of the
columns
> > are text and some numeric I was planning to load them all into strings.
> > Perhaps I could convert the output to strings on the fly or something?
>
> What are you trying to do?  That is, what's the ultimate purpose
> of building the array?  It might be easier to make suggestions if
> we knew the "what" rather than focusing on a particular "how."
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>


pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Debugging deadlocks
Next
From: Bruce Momjian
Date:
Subject: Re: 8.0.2 Beta Available