tablename as function parameter

From: "Hermann Draeger" <hkdraeger(at)gmx(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: tablename as function parameter
Date: 2005-03-15 22:15:24
Message-ID: d17o8m$dfd$01$1@news.t-online.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I'm trying to create a function (language 'sql') with table name as single input parameter,
but I always get syntax errors at "$1". Probably I am use wrong types.

simple example:

create function testfct (text) language sql as 'select count(*) from $1'

fails.

I tested type alternatives to 'text' , such as 'name' or 'sql_identifier' - no success.

What is the right type ?

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message lucas 2005-03-16 14:00:57 Re: Generic Function
Previous Message Ragnar Hafstað 2005-03-15 19:52:15 Re: Scheme not dropping