From: | SamPost <everywhereboy(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Help with dynamic SQL |
Date: | 2002-09-02 23:41:04 |
Message-ID: | 20020902234104.19700.qmail@web40301.mail.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I've been working on this function that processes the
results of another SQL statement passed in to it. The
function is called "tagged_results_query" and I'm
having errors near here:
sql ALIAS FOR $1;
.
.
.
FOR pid_relevancy IN EXECUTE ''SELECT page_id,
sum(relevancy) as relevancy FROM (''
|| quote_ident(sql)
|| '') AS res ''
|| quote_ident(tags_code)
|| '' GROUP BY page_id ORDER BY relevancy DESC;''
LOOP
The problem is, I'm trying to execute the SQL
statement in the variable sql (alias for $1), but when
I use quote_ident(sql) it truncates my SQL statement
to 32 characters, and when I double-quote it
(''sql''), it uses 'sql' literally, and not the value
of the variable sql. When I quadruple-quote it
(''''sql'''') it says "parse error at or near $1".
Basically what I need is a quote_ident that doesn't
truncate at all, so I can pass in long SQL queries
(100+ chars) to be executed and formatted by my
function. Any ideas?
Thanks,
Sam Post
=====
Sam Post
Synapse Interaction Facilitator
*MyndSparqz Services*
__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2002-09-03 00:07:47 | Re: Help with dynamic SQL |
Previous Message | Warren Massengill | 2002-09-02 22:08:32 | Re: php |