On Thu, Feb 14, 2008 at 07:51:31AM +0100, Raphaël Jacquot wrote: > in fact, I got stuck in pl/pgsql with the fact that there's no way to > access the NEW tuple in an indirect way, having the name of the column > in some variable. (I found that it could be done in plperl, but that > left me with a taste of un-completeness...) > > so, I propose the use of > > NEW[variable_containing_the_column_name]
It's not that simple. pl/pgsql is a statically typed language. Which means the types of the variable aren't really allowed to change between executions. The problem with your construct is that you can't tell a priori what its type is. The problem stems (I beleive) from the postgresql parser itself, since SQL doesn't have the structure you want either, and pl/pgsql uses the SQL parser for all the hard work. The reason why other languages can do it is because they are typed at run-time, not compile time. Have a nice day, -- Martijn van Oosterhout <[EMAIL PROTECTED]> http://svana.org/kleptog/ > Those who make peaceful revolution impossible will make violent revolution > inevitable. > -- John F Kennedy
signature.asc
Description: Digital signature