From: Jie Liang <jliang@ipinc.com>
To: Gerald Gutierrez <pozix@home.com>
Cc: pgsql-sql@postgresql.org, Richard Huxton <dev@archonet.com>
Subject: Re: Passing table names to PL/PGSQL for SELECT/UPDATE/INSERT
Date: Mon, 5 Mar 2001 10:23:59 -0800 (PST)
Message-ID: <Pine.BSF.4.10.10103051017450.10868-100000@tidal.ipinc.com> (raw)
In-Reply-To: <5.0.2.1.0.20010303202117.02a09d50@mail.rchmd1.bc.wave.home.com>
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@ipinc.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@postgresql.org)
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jliang@ipinc.com, pozix@home.com, dev@archonet.com
Subject: Re: Passing table names to PL/PGSQL for SELECT/UPDATE/INSERT
In-Reply-To: <Pine.BSF.4.10.10103051017450.10868-100000@tidal.ipinc.com>
References: <5.0.2.1.0.20010303202117.02a09d50@mail.rchmd1.bc.wave.home.com> <Pine.BSF.4.10.10103051017450.10868-100000@tidal.ipinc.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox