Skip site navigation (1) Skip section navigation (2)

tablename type?

From: des(at)des(dot)no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=)
To: pgsql-general(at)postgresql(dot)org
Subject: tablename type?
Date: 2004-07-27 18:55:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
The PL/PGSQL documentation contains at least two examples of functions
which take an argument of type "tablename", which then serves as a
table name in a query.  Here's one of those examples:

> CREATE FUNCTION concat_selected_fields(tablename) RETURNS text AS '
>     in_t ALIAS FOR $1;
>     RETURN in_t.f1 || in_t.f3 || in_t.f5 || in_t.f7;
> END;
> ' LANGUAGE plpgsql;

Typing this at the psql prompt, however, simply results in the
following message:

ERROR:  type tablename does not exist

Is the documentation incorrect, or is there something wrong with my
PostgreSQL 7.4.3 installation?

If the documentation is incorrect, is there another way to achieve
this, or do I have to use a varchar argument and construct and execute
a dynamic command?

Dag-Erling Smørgrav - des(at)des(dot)no


pgsql-general by date

Next:From: ArguileDate: 2004-07-27 20:36:48
Subject: Re: Trigger on Postgres for tables syncronization
Previous:From: Prabu SubrotoDate: 2004-07-27 17:16:11
Subject: altering a table to set serial function

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group