Re: Row type select syntax - inconsistency or misunderstanding?
От | Randall Lucas |
---|---|
Тема | Re: Row type select syntax - inconsistency or misunderstanding? |
Дата | |
Msg-id | 20060823184309.GT17085@ontology.tercent.com обсуждение исходный текст |
Ответ на | Re: Row type select syntax - inconsistency or misunderstanding? (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-general |
On Wed, Aug 23, 2006 at 02:31:35PM -0400, Tom Lane wrote: > Randall Lucas <rlucas@tercent.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
В списке pgsql-general по дате отправления: