From: | Randall Lucas <rlucas(at)tercent(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Row type select syntax - inconsistency or misunderstanding? |
Date: | 2006-08-23 18:43:09 |
Message-ID: | 20060823184309.GT17085@ontology.tercent.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Aug 23, 2006 at 02:31:35PM -0400, Tom Lane wrote:
> Randall Lucas <rlucas(at)tercent(dot)com> writes:
> > In trying to retrieve a row as a composite rowtype from a table, I'm running
> > into what appears to be an inconsistent result based on whether I select *,
> > table.*, or the list of columns in the table:
>
> FWIW, we've changed the behavior of ROW(foo.*) for 8.2 --- it now
> behaves as if you'd written out all the columns of foo explicitly.
> I don't have a solution for you in 8.1 short of writing 'em all out :-(
If one is willing to construct an expression (for example, for use in
an EXECUTE within a plpgsql function), the following works in 8.1.3:
create or replace function audit_table_thing(int) returns int as $$
declare
in_id alias for $1;
record_text text;
begin
select into record_text quote_literal(textin(record_out(thing.*))) from thing where id=in_id;
raise notice '%', record_text;
execute 'insert into thing_audit (audit_id, thing_row) values (' || in_id || ', cast(' || record_text || ' as thing) )';
return 1;
end
$$ language 'plpgsql';
Is it safe to say that the row functions are bleeding edge?
Randall
--
Randall Lucas Tercent, Inc. DF93EAD1
From | Date | Subject | |
---|---|---|---|
Next Message | barryc.ctr | 2006-08-23 19:27:09 | Can I read data load files without loading in db? |
Previous Message | Tom Lane | 2006-08-23 18:31:35 | Re: Row type select syntax - inconsistency or misunderstanding? |