Search Postgresql Archives

Re: dynamic plpgsql command on a record type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/02/10 11:07, Willy-Bas Loos wrote:
Hi,

in my plpgsql function I'm looping through tables and their fields and i
want to return their field names and the corresponding values.
It all works fine, except i can't retrieve the values, which is really a
bummer.
I tried a couple of things (in vain), of which this seemed the most
promising:
...
       t_rec_out.field_value := t_record.t_fields[t_i]; --<==== happens here
...
And then i get the error:
ERROR:  record "t_record" has no field "t_fields"

Any tips there?

This isn't going to be practical in plpgsql. You can just about do it if you want to build a "SELECT" statement and cast everything to text. Not worth the trouble though. The problem is that plpgsql is very static in its typing and just doesn't have the flexibility for this sort of task.

Use pltcl or plperl or plpython or one of the other more dynamic languages. It's straightforward then.

--
  Richard Huxton
  Archonet Ltd

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux