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

Re: Postgres / plpgsql equivalent to python's getattr() ?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: James Robinson <jlrobins(at)socialserve(dot)com>
Cc: Hackers Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Postgres / plpgsql equivalent to python's getattr() ?
Date: 2011-08-03 22:48:38
Message-ID: 25186.1312411718@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
James Robinson <jlrobins(at)socialserve(dot)com> writes:
> Python's getattr() allows for dynamic lookup of attributes on an  
> object, as in:

> 	inst = MyClass(x=12, y=24)
> 	v = getattr(inst, 'x')
> 	assert v == 12

> Oftentimes in writing data validating trigger functions, it'd be real  
> handy to be able to do a similar thing in plpgsql

> Is there something in the internals which inherently prevent this? 

plpgsql is strongly typed (much more so than python, anyway).

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Peter GeogheganDate: 2011-08-03 22:58:51
Subject: Re: Further news on Clang - spurious warnings
Previous:From: davegDate: 2011-08-03 22:28:38
Subject: Re: Further news on Clang - spurious warnings

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