composite type use in pl/gpsql

From: "Little, Douglas" <DOUGLAS(dot)LITTLE(at)orbitz(dot)com>
To: "PostgreSQL General (pgsql-general(at)postgresql(dot)org)" <pgsql-general(at)postgresql(dot)org>
Subject: composite type use in pl/gpsql
Date: 2012-06-13 20:42:40
Message-ID: 8585BA53443004458E0BAA6134C5A7FBAD0291BE@EGEXCMB01.oww.root.lcl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Merlin writes"
first, the way to do insert from composite type is like this:

insert into foo select (f).*;

if f is type of foo. The actual error you're getting is probably...."

I gave this a try. Still bumping into syntax errors
CREATE TYPE oww_mart_tbls.type_log_site_process AS
(proc_id integer,
proc_name character varying(500),
step_id integer,
step_desc character varying(2000),
step_starttime timestamp without time zone,
step_endtime timestamp without time zone,
step_returncode character varying(500),
activity_count integer,
status_flag character varying(1),
status_desc character varying(2000));
ALTER TYPE oww_mart_tbls.type_log_site_process
OWNER TO gpadmin;

Create function ...
DECLARE
-- standard variables
vSpReturn_code text;
Logsp oww_mart_tbls.type_log_site_process%ROWTYPE;
.....

insert into oww_mart_tbls.log_site_process(proc_id, proc_name, step_id, step_desc, step_starttime, step_endtime, step_returncode, activity_count, status_flag, status_desc)
select (logsp).*;

works.
Thanks for the help.

Doug Little

Sr. Data Warehouse Architect | Business Intelligence Architecture | Orbitz Worldwide
500 W. Madison, Suite 1000 Chicago IL 60661| Office 312.260.2588 | Fax 312.894.5164 | Cell 847-997-5741
Douglas(dot)Little(at)orbitz(dot)com<mailto:Douglas(dot)Little(at)orbitz(dot)com>
[cid:image001(dot)jpg(at)01CD497A(dot)68F0C620] orbitz.com<http://www.orbitz.com/> | ebookers.com<http://www.ebookers.com/> | hotelclub.com<http://www.hotelclub.com/> | cheaptickets.com<http://www.cheaptickets.com/> | ratestogo.com<http://www.ratestogo.com/> | asiahotels.com<http://www.asiahotels.com/>

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2012-06-13 21:00:10 Re: ctid ranges
Previous Message Bruce Momjian 2012-06-13 20:28:13 Re: ctid ranges