tablename type? - Mailing list pgsql-general

From des@des.no (Dag-Erling Smørgrav)
Subject tablename type?
Date
Msg-id xzpk6wpuvo4.fsf@dwp.des.no
Whole thread Raw
Responses Re: tablename type?
List 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 '
> DECLARE
>     in_t ALIAS FOR $1;
> BEGIN
>     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?

DES
--
Dag-Erling Smørgrav - des@des.no

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Before/After trigger sequencing question
Next
From: Mike Nolan
Date:
Subject: Re: Before/After trigger sequencing questiont