Re: Converting string to IN query

From: Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Converting string to IN query
Date: 2008-09-17 08:30:47
Message-ID: pu4p4f6uo8.fsf@srv.protecting.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In article <gadsb6$2v2d$1(at)news(dot)hub(dot)org>,
"Andrus" <kobruleht2(at)hot(dot)ee> writes:

> I found that following query works:
> create temp table test ( test int ) on commit drop;
> insert into test values(1);
> select * from test where test = ANY ( '{1,2}' );

> Is this best solution ?

> Will it work without causing stack overflow with 8.2 server default
> settings
> if string contains some thousands numbers ?

If you get thousands of numbers, it is safer and maybe also faster to
put them into a temporary table, analyze it, and then join it to the
table in question.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ivan Sergio Borgonovo 2008-09-17 14:43:47 FAQ: how to read EXPLAYN ANALYZE and act upon
Previous Message Andrea Moretto 2008-09-17 08:13:01 Pgpool-II and Slony-I : query lag, sequences and stored procedures need help