Re: creating a function with a variable table name

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: George Nychis <gnychis(at)cmu(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: creating a function with a variable table name
Date: 2007-03-01 16:27:19
Message-ID: 45E6FEE7.2090400@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> dp'> HAVING sum(dst_packets)>0
> dp'> ORDER BY sum(dst_packets) DESC;'
> dp-> LANGUAGE SQL;
> ERROR: syntax error at or near "$2" at character 179
> LINE 6: FROM $2
> ^
> How can I pass the table name?

Look at the EXECUTE option in plpgsql.

Joshua D. Drake

>
> Thanks!
> George
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>

--

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Palle Girgensohn 2007-03-01 16:30:05 Re: /libexec/ld-elf.so.1: Shared object "libpq.so.4" not found
Previous Message Erik Jones 2007-03-01 16:27:07 Re: Why does "group by" need to match select fields?