Re: [SQL] Querying multiple database

2013-02-06 Thread Dev Kumkar
Hello Again, Using dblink and now am facing a fatal error while tryinf to execute dblink_connect as follows: SELECT * FROM dblink_connect('host=127.0.0.1 port=5432 dbname=postgres password=test') ERROR: could not establish connection DETAIL: FATAL: password authentication failed for user "NET

[SQL] Facing authentication error on postgres 9.2 -> dblink functions

2013-02-06 Thread Dev Kumkar
Hello Everyone, I am using postgres 9.2 and when executing function dblink facing a fatal error while trying to execute dblink_connect as follows: * SELECT * FROM dblink_connect('host=127.0.0.1 port=5432 dbname=postgres password=test')* *ERROR*: could not establish connection DETAIL: FATA

[SQL] Re: [ADMIN] Facing authentication error on postgres 9.2 -> dblink functions

2013-02-06 Thread Albe Laurenz
Dev Kumkar wrote: > I am using postgres 9.2 and when executing function dblink facing a fatal > error while trying to > execute dblink_connect as follows: > > SELECT * FROM dblink_connect('host=127.0.0.1 port=5432 dbname=postgres > password=test') > > ERROR: could not establish connecti

[SQL] Re: [HACKERS] Facing authentication error on postgres 9.2 -> dblink functions

2013-02-06 Thread Andrew Dunstan
On 02/06/2013 08:09 AM, Dev Kumkar wrote: Hello Everyone, I am using postgres 9.2 and when executing function dblink facing a fatal error while trying to execute dblink_connect as follows: /SELECT * FROM dblink_connect('host=127.0.0.1 port=5432 dbname=postgres password=test')/ *ERROR*: co

[SQL] create an index on unnest

2013-02-06 Thread Francois Payette
Greetings! I need the following: create an index on multiple values for a single row. My other solution consists of a lot of duplicated rows in seperate tables and triggers and indexes, resulting in slower performance. The following fails on 9.2, it says ERROR: index expression cannot return a

Re: [SQL] create an index on unnest

2013-02-06 Thread Francois Payette
well sorry for bothering this list and answering myself, I just came across the array operators. this does the trick drop table if exists test; create table test (id serial, data text ); insert into test VALUES(DEFAULT, 'testdata'); drop function if exists testfct(); CREATE OR REPLACE FUNCTION

Re: [SQL] Setting a default value for a select statement without results

2013-02-06 Thread JORGE MALDONADO
This solution gave me the result I need, but it seems the process takes longer when COALESCE is added. What do you mean with the comment of "and you are happy with its performance" ? Does it have to do with performance? Regards, Jorge Maldonado On Tue, Feb 5, 2013 at 10:07 PM, Jasen Betts wrot

[SQL] Conditional expression in an UPDATE statement

2013-02-06 Thread JORGE MALDONADO
Can I use a conditional expression in an UPDATE query like this: UPDATE table_1 SET field_1 = CASE WHEN (condition) THEN (COALESCE(query_1, -1)) ELSE (COALESCE(query_1, -2)) END With respect, Jorge Maldonado

Re: [SQL] Conditional expression in an UPDATE statement

2013-02-06 Thread Jasen Betts
On 2013-02-07, JORGE MALDONADO wrote: > Can I use a conditional expression in an UPDATE query like this: > > UPDATE table_1 SET > field_1 = > CASE WHEN (condition) THEN (COALESCE(query_1, -1)) > ELSE (COALESCE(query_1, -2)) > END > yesh, that should work. -- ⚂⚃ 100% natural -- Se