Re: Passing table names to PL/PGSQL for SELECT/UPDATE/INSERT

From: Jie Liang <jliang(at)ipinc(dot)com>
To: Gerald Gutierrez <pozix(at)home(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, Richard Huxton <dev(at)archonet(dot)com>
Subject: Re: Passing table names to PL/PGSQL for SELECT/UPDATE/INSERT
Date: 2001-03-05 18:23:59
Message-ID: Pine.BSF.4.10.10103051017450.10868-100000@tidal.ipinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Unfortunately, PL/PGSQL cannot pass table name.
I have same problem, only thing I can do is pass an integer, then use IF
.. THEN .. ELSE .. END IF;

Jie LIANG

St. Bernard Software

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang(at)ipinc(dot)com
www.stbernard.com
www.ipinc.com

On Sat, 3 Mar 2001, Gerald Gutierrez wrote:

>
> I've written my Dijkstra's algorithm in PL/PGSQL. It didn't turn out to be
> a big deal at all actually, programming-wise. I understand execution speed
> will be poor but it shouldn't be any slower than having something else,
> like PHP or Java, execute logic and query the database.
>
> I'd like to generalize my function. As per Richard Huxton's suggestion to
> create tables named after session ID (thanks Richard)s, I'd like to pass in
> some table names so that the algorithm can read from and write into tables
> that I specify as parameters to the function. Sometihng like:
>
> select dijkstra(inputtablename, outputtablename);
>
> I've tried typing the parameters as TEXT, and then just inserting $1 in the
> select (e.g. SELECT * from $1 ...) This doesn't work, nor did a number of
> other ways I tried.
>
> How can this be done?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jie Liang 2001-03-05 18:28:55 Re:
Previous Message clayton cottingham 2001-03-05 16:40:53 Re: Two way encryption in PG???