Re: Dblink and ISDN - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Dblink and ISDN
Date
Msg-id 3CA9F15F.5040101@joeconway.com
Whole thread Raw
In response to Dblink and ISDN  ("Darko Prenosil" <Darko.Prenosil@finteh.hr>)
List pgsql-hackers
Joe Conway wrote:
> Darko Prenosil wrote:
> 
>> SAMPLE:
>>
>>  create view myremotetable as
>>  select dblink_tok(t1.dblink_p,0) as f1, dblink_tok(t1.dblink_p,1) as f2
>>  from (select dblink('hostaddr=127.0.0.1 port=5432 dbname=template1 
>> user=postgres password=postgres'
>>                     ,'select proname, prosrc from pg_proc') as 
>> dblink_p) as t1;
>>
>>  
>>
>> select f1, f2 from myremotetable where f1 like 'bytea%';
>>
> 
> You could write the query directly instead of using a view, i.e.
> 
> select dblink_tok(t1.dblink_p,0) as f1, dblink_tok(t1.dblink_p,1) as f2
> from (select dblink('hostaddr=127.0.0.1 port=5432 dbname=template1
> user=postgres password=postgres','select proname, prosrc from pg_proc') 
> as dblink_p WHERE proname LIKE 'bytea%') as t1;
>

Oops, messed up my cut and paste, and forgot to double the quotes around 
bytea%. This one I tested ;) to work fine:
select dblink_tok(t1.dblink_p,0) as f1, dblink_tok(t1.dblink_p,1) as f2
from (select dblink('hostaddr=127.0.0.1 port=5432 dbname=template1
user=postgres password=postgres','select proname, prosrc from pg_proc 
WHERE proname LIKE ''bytea%''')
as dblink_p) as t1;

Joe



pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: mailing list problem
Next
From: "Christopher Kings-Lynne"
Date:
Subject: SET NOT NULL/DROP NOT NULL patch