Re: SELECT INTO Array?

From: "Zitan Broth" <zitan(at)mediasculpt(dot)net>
To: "Michael Fuhr" <mike(at)fuhr(dot)org>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: SELECT INTO Array?
Date: 2005-04-02 02:00:43
Message-ID: 001e01c53727$c8d37280$4701a8c0@GarethsLaptop
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)fuhr(dot)org>
To: "Zitan Broth" <zitan(at)mediasculpt(dot)net>
Cc: <pgsql-general(at)postgresql(dot)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/
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2005-04-02 02:39:29 Re: Disk Encryption - Postgresql vs. Oracle
Previous Message Alvaro Herrera 2005-04-02 01:57:25 Re: Debugging deadlocks