Re: plpgsql variable substitution problem ...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Wickham <greg(at)geelong(dot)com>
Cc: pgsql-sql(at)hub(dot)org
Subject: Re: plpgsql variable substitution problem ...
Date: 2000-05-28 18:15:44
Message-ID: 12699.959537744@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Greg Wickham <greg(at)geelong(dot)com> writes:
> 000528.19:45:45.725 [9553] query: SELECT max( $1 ) FROM $2

There is no facility in plpgsql for run-time specification of a table
name, and probably never will be for the general case. It's possible
that it could be made to work for selection of a particular table among
the inheritance children of a specified table, but not for any arbitrary
table, unless we want to give up preparsing and preplanning of plpgsql
queries.

pltcl does everything on-the-fly at runtime, so you could do this in
that language, I think (and accept the resulting speed penalty).

A more interesting question is whether you shouldn't redesign your
database schema so that you don't need to do this...

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Carolyn Wong 2000-05-29 05:37:47 date format
Previous Message Greg Wickham 2000-05-28 17:48:11 plpgsql variable substitution problem ...