Re: Access a Field / Column of a resultset by Number - Mailing list pgsql-general

From Daniel Schuchardt
Subject Re: Access a Field / Column of a resultset by Number
Date
Msg-id hep13k$1c9q$1@news.hub.org
Whole thread Raw
Responses Re: Access a Field / Column of a resultset by Number  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
thats exactly the same i'm looking for:

http://wiki.postgresql.org/wiki/Todo
http://archives.postgresql.org/pgsql-patches/2005-07/msg00458.php

(todo list for plpgsql)

*Server-Side Languages
*PL/pgSQL
*
*[D] Allow listing of record column names, and access to record columns
*via variables, e.g. columns := r.(*), tval2 := r.(colname)
*
*Re: PL/PGSQL: Dynamic Record Introspection


is that is possible in any pl* language?




Daniel Schuchardt schrieb:
> hy group,
>
> i currently look for a solution to access a resultset in a db-stored
> function by number. in plpgsql thats not possible.
> so i checked out plpython. so far so good, thats working:
>
> CREATE OR REPLACE FUNCTION dokv_dorecnokeywords(sqlstatement VARCHAR)
> RETURNS VOID AS
> $$
>  rv = plpy.execute(sqlstatement, 1)
>  |||||->"SELECT * FROM art WHERE ak_nr='TEST'"
>  s  = 'ak_bez'  |||| fieldname is static here, should be by number
>  plpy.notice(s+'='+rv[0][s])
>  return
> $$ LANGUAGE plpythonu;
>
> now i need a solution to get the number of fields as well as the
> fieldnames of that resultset and run through all fields (by number or by
> name). (i need the fieldname too)
>


--
Daniel Schuchardt
/Softwareentwicklung/

/http://www.prodat-sql.de/

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Cannot allocate memory for output buffer
Next
From: Cjkalbente
Date:
Subject: Re: Mysql migration to Postgresql