Skip site navigation (1) Skip section navigation (2)

Re: Access a Field / Column of a resultset by Number

From: Daniel Schuchardt <d(dot)schuchardt(at)prodat-sql(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Access a Field / Column of a resultset by Number
Date: 2009-11-27 17:09:25
Message-ID: hep13k$1c9q$ (view raw or whole thread)
Lists: pgsql-general
thats exactly the same i'm looking for:

(todo list for plpgsql)

*Server-Side Languages
*[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) 
> $$
>  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


In response to


pgsql-general by date

Next:From: Jeff AmielDate: 2009-11-27 20:35:50
Subject: empty string causes planner to avoid index. Makes me sad.
Previous:From: Scott MarloweDate: 2009-11-27 16:01:52
Subject: Re: READ ONLY & I/O ERROR

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group