Re: use of IN() with literals

From: David W Noon <dwnoon(at)ntlworld(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: use of IN() with literals
Date: 2010-05-18 17:28:45
Message-ID: 20100518182845.4934d8ae@karnak.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 18 May 2010 10:05:49 -0700 (PDT), Dennis Gearon wrote about
[GENERAL] use of IN() with literals:

>I'm trying to use the following script: (to give command line ability
>to change grant on all tables in public in a database)
>
>psql -t -c “SELECT ‘GRANT $1 ON public.’ || t.relname || ‘ TO $2;’
>from pg_class t, pg_namespace s WHERE t.relkind IN (‘r’, ‘v’, ‘S’) AND
>t.relnamespace=s.oid AND s.nspname=’public’;” $3 | psql $3
>
>and it always fails at the "IN(‘r’, ‘v’, ‘S’)" part. psql won't accept
>the literals in the IN clause. Is this normal? What could fix this?

It works for me, using 8.4.2.

>I've tried just doing:
>(
>after logging in to psql connected to a specific database)
>
>select * from pg_class where relkind IN IN (‘r’, ‘v’, ‘S’);

You have the word "IN" twice.
--
Regards,

Dave [RLU #314465]
======================================================================
dwnoon(at)ntlworld(dot)com (David W Noon)
======================================================================

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Hernan Danielan 2010-05-18 19:18:48 Connection lost
Previous Message Thomas Kellerer 2010-05-18 17:25:21 Re: use of IN() with literals