pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julie Hunt <jhunt@chac.qld.edu.au>
To: pgsql-sql@postgresql.org
Subject: Functions and tablenames
Date: Fri, 14 Apr 2000 16:51:04 +1000
Message-ID: <002701bfa5dd$cfc346a0$9a14a8c0@julies> (raw)

Hi
I would like to create a function that passes a tablename as a variable, but I do not know what 'datatype' a tablename is supposed to be.

CREATE FUNCTION find_max_id(int4, tablename?) RETURNS int4
AS 'Select max($1) FROM $2'
LANGUAGE 'sql';

When I put text as the datatype for the tablename the error was a problem near $2.
Could someone please help me.
Thanks
Julie Hunt

Message-ID: <002701bfa5dd$cfc346a0$9a14a8c0@julies>
Permalink:  ../002701bfa5dd$cfc346a0$9a14a8c0@julies/
Also on:    postgresql.org/message-id/002701bfa5dd$cfc346a0$9a14a8c0@julies

 · 

reply

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: jhunt@chac.qld.edu.au
  Subject: Re: Functions and tablenames
  In-Reply-To: <002701bfa5dd$cfc346a0$9a14a8c0@julies>
  References: <002701bfa5dd$cfc346a0$9a14a8c0@julies>

* 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