Skip site navigation (1) Skip section navigation (2)

Re: Data into an array

From: sub3 <steve(at)subwest(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Data into an array
Date: 2008-08-27 00:40:20
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Thanks, I got it to work.

But now I have a different problem.
If I execute:
  select * from getvss(1, now())
it works. But instead, if I execute it as:
  select *, getvss(, now()) from d1

I don't get separate columns for the data coming from getvss, it is all in
one column, unlike the previous select.  Is there anyway to force that into
different columns?

CREATE or REPLACE FUNCTION getvss(f_pvid integer, f_time timestamp without
time zone, OUT o_port integer[], OUT o_conf double precision[], OUT d_port
integer[], OUT d_conf double precision[])
 as $$ DECLARE
  vssview RECORD;
  FOR vssview IN select vss_orig.portid, vss_orig.confidence from vss,
vss_orig where vss.vssmsg = vss_orig.vssmsg AND pvid = f_pvid and f_time
between starttime and endtime LOOP
    o_port := array_append(o_port, vssview.portid);
    o_conf := array_append(o_conf, vssview.confidence);
  FOR vssview IN select vss_dest.portid, vss_dest.confidence from vss,
vss_dest where vss.vssmsg = vss_dest.vssmsg AND pvid = f_pvid and f_time
between starttime and endtime LOOP
    d_port := array_append(d_port, vssview.portid);
    d_conf := array_append(d_conf, vssview.confidence);
$$ LANGUAGE plpgsql;

View this message in context:
Sent from the PostgreSQL - sql mailing list archive at

In response to


pgsql-sql by date

Next:From: Pavel StehuleDate: 2008-08-27 03:06:40
Subject: Re: Data into an array
Previous:From: Pavel StehuleDate: 2008-08-26 19:42:20
Subject: Re: Data into an array

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group