Re: How to extract a value from a record using attnum or attname? - Mailing list pgsql-general

From Dimitri Fontaine
Subject Re: How to extract a value from a record using attnum or attname?
Date
Msg-id m27hcrdaz0.fsf@2ndQuadrant.fr
Whole thread Raw
In response to How to extract a value from a record using attnum or attname?  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: How to extract a value from a record using attnum or attname?
Re: How to extract a value from a record using attnum or attname?
List pgsql-general
"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:

> PL/pgSQL seems tantalizingly close to being useful for developing a
> generalized trigger function for notifying the client of changes.  I
> don't know whether I'm missing something or whether we're missing a
> potentially useful feature here.  Does anyone see how to fill in
> where the commented question is, or do I need to write this function
> in C?

See those:

  http://tapoueh.org/articles/blog/_Dynamic_Triggers_in_PLpgSQL.html
  http://www.pgsql.cz/index.php/PL_toolbox_%28en%29#Record.27s_functions

>   for i in array_lower(keycols, 1)..array_upper(keycols, 1) loop
>     select quote_ident(attname) from pg_catalog.pg_attribute
>       where attrelid = tg_relid and attnum = keycols[i]::oid

Beware of attisdropped, which I've not fixed in the published URL
before (the tapoueh.org one).

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support

pgsql-general by date:

Previous
From: Aleksey Tsalolikhin
Date:
Subject: database is bigger after dump/restore - why? (60 GB to 109 GB)
Next
From: "Joshua D. Drake"
Date:
Subject: PgEast 2011: Talks and trainings up