Re: CVS to In_list without dynamic SQL, how?

From: Michael Moore <michaeljmoore(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: postgres list <pgsql-sql(at)postgresql(dot)org>
Subject: Re: CVS to In_list without dynamic SQL, how?
Date: 2015-12-09 21:30:50
Message-ID: CACpWLjPLBop8pgahenqt8m-V5Sc9dSJV=MRDCDVQ-qQtCVqDxA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Very nice!
In my case the value being compared is numeric. I tried:
SELECT to_char( 1 , '999') = ANY( string_to_array('1,2,3,4,5', ','));
but the result is FALSE

On Wed, Dec 9, 2015 at 12:19 PM, David G. Johnston <
david(dot)g(dot)johnston(at)gmail(dot)com> wrote:

> On Wed, Dec 9, 2015 at 1:16 PM, Michael Moore <michaeljmoore(at)gmail(dot)com>
> wrote:
>
>> DO $$declare
>> csv text := '''1'',''2'',''3''';
>> v_var text;
>> begin
>> select var into v_var from tx_vendor where vendor_key in csv;
>> RAISE NOTICE 'result=(%)', v_var ;
>> end$$;
>>
>> Obviously the above does not work, but hopefully explain what I am trying
>> to accomplish.
>> Thanks,
>> Mike
>>
>>
> ​SELECT '1' = ANY(string_to_array('1,2,3,4,5', ','))
>
> David J.​
>
>
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Christopher Molnar 2015-12-09 21:57:35 regexp_replace question/suggestions needed
Previous Message David G. Johnston 2015-12-09 20:19:38 Re: CVS to In_list without dynamic SQL, how?