[GENERAL] Re: Exists subquery in an update ignores the effects of the update itself

2014-09-04 Thread David G Johnston
Jeff Janes wrote I want to update some data in unique column. Some of the updates would conflict if applied to eligible rows, and for now I want to skip those updates, applying only one of a set of conflicting ones. I can use a not exists subquery to detect when the new value would conflict

[GENERAL] Is EXISTS the most efficient approach for PostgreSql to check for existence of nodes in a tree?

2012-05-17 Thread Seref Arikan
I have a key value table in my Postgresql db, which represents hierarchical data through parent_feature_mapping column that points to id of feature_mapping_id column of the same table. I need to select root nodes that has children which satisfy various conditions. The conditions may extend to

Re: [GENERAL] Is EXISTS the most efficient approach for PostgreSql to check for existence of nodes in a tree?

2012-05-17 Thread Rob Sargentg
On 05/17/2012 03:06 AM, Seref Arikan wrote: I have a key value table in my Postgresql db, which represents hierarchical data through parent_feature_mapping column that points to id of feature_mapping_id column of the same table. I need to select root nodes that has children which satisfy

Re: [GENERAL] pg_dump exists without any message when running from windows task scheduler

2009-09-10 Thread Andrus
The installer should have an option for 'client only' so you end up with psql, pg_dump and friends but not the database. From http://www.postgresql.org/download/windows : pgInstaller packages are only being maintained for PostgreSQL 8.2 and 8.3. 8.3 pg_dump returns error for 8.4 database.

Re: [GENERAL] pg_dump exists without any message when running from windows task scheduler

2009-09-09 Thread Andrus
Chris, Thank you. I don't know if you can do that. Why do you need to? I need to run pg_dump at 2:00 AM every night automatically in Windows computer where PostgreSql server is not installed. If you reference the original files (c:\program files\... or where-ever you installed postgres

Re: [GENERAL] pg_dump exists without any message when running from windows task scheduler

2009-09-09 Thread Chris
Andrus wrote: Chris, Thank you. I don't know if you can do that. Why do you need to? I need to run pg_dump at 2:00 AM every night automatically in Windows computer where PostgreSql server is not installed. The installer should have an option for 'client only' so you end up with psql,

[GENERAL] pg_dump exists without any message when running from windows task scheduler

2009-09-08 Thread Andrus
In some servers 8.4 pg_dump exits without any message if running from Task Scheduler. To explore this, I created scheduler task containing line cmd After that I can type manually commands: C:\MyApp\pg_dumpdir /w .. [.] [..] comerr32.dll gssapi32.dll k5sprt32.dll

Re: [GENERAL] pg_dump exists without any message when running from windows task scheduler

2009-09-08 Thread Chris
Andrus wrote: In some servers 8.4 pg_dump exits without any message if running from Task Scheduler. To explore this, I created scheduler task containing line cmd After that I can type manually commands: C:\MyApp\pg_dumpdir /w .. [.] [..] comerr32.dll gssapi32.dll

[GENERAL] if exists...does it exists for insert statments?

2007-12-11 Thread Pau Marc Munoz Torres
could i use a sentence similar to the mysql sentence insert if not exist into SP values ('cesp','sp'); in postgresql? pau -- Pau Marc Muñoz Torres Laboratori de Biologia Computacional Institut de Biotecnologia i Biomedicina Vicent Villar Universitat Autonoma de Barcelona E-08193

Re: [GENERAL] if exists...does it exists for insert statments?

2007-12-11 Thread Pavel Stehule
Hello On 11/12/2007, Pau Marc Munoz Torres [EMAIL PROTECTED] wrote: could i use a sentence similar to the mysql sentence insert if not exist into SP values ('cesp','sp'); insert into sp select 'cesp','sp' except select * from SP; Regards Pavel Stehule in postgresql? pau -- Pau

Re: [GENERAL] if exists...does it exists for insert statments?

2007-12-11 Thread Richard Broersma Jr
--- On Tue, 12/11/07, Pau Marc Munoz Torres [EMAIL PROTECTED] wrote: could i use a sentence similar to the mysql sentence insert if not exist into SP values ('cesp','sp'); in postgresql? Using standard ANSI-SQL the statement could be re-written: INSERT INTO SP SELECT a, b

Re: [GENERAL] if exists...does it exists for insert statments?

2007-12-11 Thread Pau Marc Munoz Torres
Thanks, i'll test it tomorrow pau 2007/12/11, Richard Broersma Jr [EMAIL PROTECTED]: --- On Tue, 12/11/07, Pau Marc Munoz Torres [EMAIL PROTECTED] wrote: could i use a sentence similar to the mysql sentence insert if not exist into SP values ('cesp','sp'); in postgresql? Using

Re: [GENERAL] if exists...does it exists for insert statments?

2007-12-11 Thread Richard Broersma Jr
--- On Tue, 12/11/07, Pau Marc Munoz Torres [EMAIL PROTECTED] wrote: Thanks, i'll test it tomorrow OOPS, I just noticed a mistake. INSERT INTO SP SELECT a, b FROM ( VALUES ( 'cesp', 'sp' )) AS tmp( a, b ) LEFT JOIN Sp ON (Sp.col1,Sp.col2)=(tmp.a,tmp.b) WHERE

[GENERAL] Optimizing exists

2007-09-18 Thread Steve Crawford
Does the planner automatically add limit 1 to exists sub-selects? In other words, take an update like: update foo set itexists = exists (select 1 from bar where bar.something = foo.something); If the sub-select returns a large result set, will there be any benefit to adding limit 1 to the

Re: [GENERAL] Optimizing exists

2007-09-18 Thread Tom Lane
Steve Crawford [EMAIL PROTECTED] writes: If the sub-select returns a large result set, will there be any benefit to adding limit 1 to the sub-select or does the query planner automatically deduce that limit 1 is the correct interpretation? It does, although poking at it I notice a bit of a

Re: [GENERAL] IF EXISTS

2006-09-25 Thread Dawid Kuroczko
On 9/21/06, stevethames [EMAIL PROTECTED] wrote: Ok, thanks, Jeff. This is not a critical problem. Just annoying. I'll wait for 8.2. BTW, while I can see the reason for adding the IF EXISTS clause to the language for checking the existence of objects, wouldn't it be easier to simply provide

Re: [GENERAL] IF EXISTS

2006-09-24 Thread stevethames
Ok, thanks, Jeff. This is not a critical problem. Just annoying. I'll wait for 8.2. BTW, while I can see the reason for adding the IF EXISTS clause to the language for checking the existence of objects, wouldn't it be easier to simply provide the PL/PgSQL language for script loading? Then it

[GENERAL] IF EXISTS

2006-09-20 Thread stevethames
I have a script that sets up my databases which I run whenever I change any of the functions. It has a number of things it does that are unnecessary and cause errors. I create some types, sequences, etc. The error messages are irritating. I'd like to do something like this: IF NOT EXISTS

Re: [GENERAL] IF EXISTS

2006-09-20 Thread Jeff Davis
On Wed, 2006-09-20 at 14:18 -0700, stevethames wrote: I have a script that sets up my databases which I run whenever I change any of the functions. It has a number of things it does that are unnecessary and cause errors. I create some types, sequences, etc. The error messages are

Re: [GENERAL] IF EXISTS

2006-09-20 Thread Karsten Hilbert
On Wed, Sep 20, 2006 at 04:12:16PM -0700, Jeff Davis wrote: In 8.2, which is currently still in production, they have added the feature where you can do things like: DROP SEQUENCE IF EXISTS mysequence; CREATE SEQUENCE mysequence; Which makes writing SQL scripts much easier. They also

[GENERAL] IF EXISTS

2005-11-14 Thread P.M
Hi, I would like to know if IF EXISTS exists under postgresql ? because i did not find it. before to create users or database, i would like to be sure that they do not exist already. so how can i test it and do something like : IF EXISTS database test DROP database test; thanks a lot, Maileen

Re: [GENERAL] IF EXISTS

2005-11-14 Thread Bruno Wolff III
On Mon, Nov 14, 2005 at 13:20:59 -0800, P.M [EMAIL PROTECTED] wrote: Hi, I would like to know if IF EXISTS exists under postgresql ? because i did not find it. before to create users or database, i would like to be sure that they do not exist already. so how can i test it and do

Re: [GENERAL] IF EXISTS

2005-11-14 Thread Jaime Casanova
On 11/14/05, P.M [EMAIL PROTECTED] wrote: Hi, I would like to know if IF EXISTS exists under postgresql ? because i did not find it. before to create users or database, i would like to be sure that they do not exist already. so how can i test it and do something like : IF EXISTS

Re: [GENERAL] IF EXISTS

2005-11-14 Thread Samer Abukhait
How about if exists (select .. from ..) On 11/14/05, Jaime Casanova [EMAIL PROTECTED] wrote: On 11/14/05, P.M [EMAIL PROTECTED] wrote: Hi, I would like to know if IF EXISTS exists under postgresql ? because i did not find it. before to create users or database, i would like to be

[GENERAL] IF EXISTS?

2003-11-02 Thread Henrik W. Hansen
Hi all Can I make something linke: IF EXISTS(company_id_seq) DROP SEQUENCE company_id_seq; in a DDL where i creates all my tables? /Henrik ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Rory Campbell-Lange
I have been informed that at present (postgres 7.3.2) using IN is not advised, and I should replace it with EXISTS. I can't seem to get it to work. I've tried replacing (example): SELECT name FROM people WHERE state IN ( SELECT id

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Csaba Nagy
You should use something like: SELECT name FROM people p WHERE exists ( SELECT 1 FROM states WHERE name = p.state ) AND state ~* 'r'; On Tue,

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread DeJuan Jackson
Rory Campbell-Lange wrote: I have been informed that at present (postgres 7.3.2) using IN is not advised, and I should replace it with EXISTS. I can't seem to get it to work. I've tried replacing (example): SELECT name FROM people WHERE state IN ( SELECT

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Mike Mascari
Rory Campbell-Lange wrote: I have been informed that at present (postgres 7.3.2) using IN is not advised, and I should replace it with EXISTS. I can't seem to get it to work. ... SELECT name FROM people WHERE exists ( SELECT

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Felipe Schnack
Why using IN is not advisable??? On 22 Jul 2003 18:36:10 +0200 Csaba Nagy [EMAIL PROTECTED] wrote: You should use something like: SELECT name FROM people p WHERE exists ( SELECT 1 FROM

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Csaba Nagy
Actually, even better: select name from people p, states s where p.state = s.name and p.state ~* 'r'; Cheers, Csaba. On Tue, 2003-07-22 at 18:36, Csaba Nagy wrote: You should use something like: SELECT name FROM people p WHERE exists (

Re: [GENERAL] using EXISTS instead of IN: how?

2003-07-22 Thread Mike Mascari
Felipe Schnack wrote: Why using IN is not advisable??? http://www.postgresql.org/docs/faqs/FAQ.html#4.22 But I believe Tom has fixed this for the upcoming 7.4. Mike Mascari [EMAIL PROTECTED] ---(end of broadcast)--- TIP 1: subscribe and

[GENERAL] Function exists

2001-09-25 Thread Mihai Gheorghiu
I want to write a function that finds out whether a function already exists. Is that possible? How? Thank you all. ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL

Re: [GENERAL] Function exists

2001-09-25 Thread Marko Kreen
On Tue, Sep 25, 2001 at 02:20:23PM -0400, Mihai Gheorghiu wrote: I want to write a function that finds out whether a function already exists. Is that possible? How? select * from pg_proc where proname = ??; you can run psql with switch -E, then it shows intenal queries it performs. Eg., for