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

Syntax for cmd to many quotes?

From: "David B" <postgresql(at)thegatelys(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Syntax for cmd to many quotes?
Date: 2004-04-20 23:24:32
Message-ID: (view raw or whole thread)
Lists: pgsql-sql

This is driving me crazy...I'm sure it's possible but that I am getting the
#quotes wrong in some way...
I keep getting unterminated string matter how many quotes I

I have a FN that I want to loop through all views and populate a table with
a count(*) from each views.

To do it I'm doing a LOOP around all views...something like:

FOR r_rec IN SELECT viewname from pg_views

    sql_string := 'INSERT INTO temp_table ( view_name, row_count ) SELECT
''' || r_rec.viewname || ''', count(*) FROM ' || r_rec.viewname  || ' ; ' ;

    EXEC sql_string ;



Building that sql_string is the problem.
Any thoughts folks?

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.648 / Virus Database: 415 - Release Date: 3/31/2004


pgsql-sql by date

Next:From: Bruno Wolff IIIDate: 2004-04-21 02:00:10
Subject: Re: transaction
Previous:From: owDate: 2004-04-20 19:25:25
Subject: Follow-up: FK constraint performance

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