Re: [GENERAL] Recursion in triggers?

2010-01-24 Thread Alban Hertroys
On 24 Jan 2010, at 5:36, Gauthier, Dave wrote: Hi: I’m dealing with a hierarchical design where changes in one record can and should cause changes in other records lower inthe hierarchy. I’m trying to use update triggers to do this. And recursion would be a real nice way to do this.

[GENERAL] Questions about connection clean-up and invalid page header

2010-01-24 Thread Herouth Maoz
Hi Everybody. I have two questions. 1. We have a system that is accessed by Crystal reports which is in turned controlled by another (3rd party) system. Now, when a report takes too long or the user cancels it, it doesn't send a cancel request to Postgres. It just kills the Crystal process

[GENERAL] Self-referential records

2010-01-24 Thread Ovid
Assuming I have the following table: CREATE TABLE refers ( idSERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, parent_id INTEGER NOT NULL, FOREIGN KEY (parent_id) REFERENCES refers(id) ); I need to insert two records so that select * from refers looks

Re: [GENERAL] Self-referential records

2010-01-24 Thread Leif Biberg Kristensen
On Sunday 24. January 2010 14.43.10 Ovid wrote: Assuming I have the following table: CREATE TABLE refers ( idSERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, parent_id INTEGER NOT NULL, FOREIGN KEY (parent_id) REFERENCES refers(id) ); I need to

Re: [GENERAL] Self-referential records

2010-01-24 Thread Bill Moran
On 1/24/10 8:43 AM, Ovid wrote: Assuming I have the following table: CREATE TABLE refers ( idSERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, parent_id INTEGER NOT NULL, FOREIGN KEY (parent_id) REFERENCES refers(id) ); I need to insert two

Re: [GENERAL] Self-referential records

2010-01-24 Thread Thomas Kellerer
Ovid wrote on 24.01.2010 14:43: Assuming I have the following table: CREATE TABLE refers ( idSERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, parent_id INTEGER NOT NULL, FOREIGN KEY (parent_id) REFERENCES refers(id) ); I need to insert two

[GENERAL] How to use PG_DUMP?

2010-01-24 Thread Andre Lopes
Hi, I'am having trouble using PG_DUMP. The problem is the following, I have made some minor changes to my database, I have added one table. I have generated the CREATE statements using a modeling tool, and I have created another database to test the changes. My problem is the order of the INSERT

Re: [GENERAL] Self-referential records

2010-01-24 Thread Andreas Kretschmer
Ovid curtis_ovid_...@yahoo.com wrote: Assuming I have the following table: CREATE TABLE refers ( idSERIAL PRIMARY KEY, name VARCHAR(255) NOT NULL, parent_id INTEGER NOT NULL, FOREIGN KEY (parent_id) REFERENCES refers(id) ); I need to insert

Re: [GENERAL] Self-referential records

2010-01-24 Thread Andreas Kretschmer
Xi Shen davidshe...@googlemail.com wrote: To handle that you can set the constzraint deferrable, initially deferred: test=# CREATE TABLE refers ( id SERIAL  PRIMARY KEY, name VARCHAR(255) NOT NULL, parent_id INTEGER NOT NULL, FOREIGN KEY (parent_id) REFERENCES refers(id) deferrable

Re: [GENERAL] [HACKERS] Sugerencia de opcion

2010-01-24 Thread Robert Haas
2009/1/22 Informatica-Cooperativa Cnel. Oviedo informat...@coopovie.com.py: Buenos Dias todos,                             Soy un usuario de postgres de Paraguay, consulto sobre la posibilidad de inclucion en la futura version la siguiente sentencia(Uso de alias en la condicion HAVING ):   

Re: [GENERAL] Self-referential records

2010-01-24 Thread Xi Shen
On Sun, Jan 24, 2010 at 10:36 PM, Andreas Kretschmer akretsch...@spamfence.net wrote: Ovid curtis_ovid_...@yahoo.com wrote: Assuming I have the following table:     CREATE TABLE refers (       id        SERIAL  PRIMARY KEY,       name      VARCHAR(255) NOT NULL,       parent_id INTEGER NOT

Re: [GENERAL] Self-referential records

2010-01-24 Thread Peter Geoghegan
What is the preferred way to enforce that there is at least one orphan record if any at all, and that a record is not a Marty McFly type descendent of itself? I would suggest that a statement level after trigger is the way to go, but I myself have never actually had to enforce this. Regards,

Re: [GENERAL] Self-referential records

2010-01-24 Thread Andreas Kretschmer
Xi Shen davidshe...@googlemail.com wrote: what if you insert other values like '1', '999'? will the insertion successful? if so, what's the difference between a deferred reference and no reference at all? Nice question ;-) Okay, recreate the table but without NOT NULL: test=# CREATE TABLE

Re: [GENERAL] Self-referential records

2010-01-24 Thread Wayne E. Pfeffer
If you do not use null to represent a root node, when you go to unwind the data from the table to generate a hierarchy tree, you could end up with an infinite loop. The query will always be looking for the next parent in the hierarchy. Meaning, you will want to find the parent of a node using the

Re: [GENERAL] Self-referential records

2010-01-24 Thread Leif Biberg Kristensen
On Sunday 24. January 2010 16.22.00 Wayne E. Pfeffer wrote: If you do not use null to represent a root node, when you go to unwind the data from the table to generate a hierarchy tree, you could end up with an infinite loop. The query will always be looking for the next parent in the

Re: [GENERAL] Referencing to system catalog problem

2010-01-24 Thread Davor J.
Thank you Adrian. I apparently missed that post. Guess I will have to come up with an different approach. Adrian Klaver adrian.kla...@gmail.com wrote in message news:201001231002.15874.adrian.kla...@gmail.com... On Saturday 23 January 2010 6:15:36 am Davor J. wrote: I am logged in as

Re: [GENERAL] Recursion in triggers?

2010-01-24 Thread Craig Ringer
Gauthier, Dave wrote: What I need to know is if, in the “after” update trigger I make the subsequent updates to other records in the same table, with the OLD/NEW record ponters be set properly in those subsequent update trigger invocations? They'll be set properly. I'm not sure they'll be

Re: [GENERAL] [HACKERS] Sugerencia de opcion

2010-01-24 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: 2009/1/22 Informatica-Cooperativa Cnel. Oviedo informat...@coopovie.com.py:     SELECT id, sum(salario) as SumaSalario     FROM salarios     GROUP BY id     HAVING SumaSalario500; I've wished for that syntax once or twice myself, but I'm assuming

Re: [GENERAL] How to use PG_DUMP?

2010-01-24 Thread Tom Lane
Andre Lopes lopes80an...@gmail.com writes: I have generated the CREATE statements using a modeling tool, and I have created another database to test the changes. My problem is the order of the INSERT statements generated by PG_DUMP [-a -d], causing errors because of the order of the INSERTS.

Re: [GENERAL] Recursion in triggers?

2010-01-24 Thread Gauthier, Dave
Ya, I worded the original poorley. Let me try again The after update trigger on the table sets some of the NEW.column values for record A. Then it executes another update on the same table, but on record B. That second execution of the update trigger needs to see the mods made to record

Re: [GENERAL] How to use PG_DUMP?

2010-01-24 Thread Andre Lopes
Hi, I have tested with pg_dump -u -p 5432 -d -f c:\test.sql mydatabase but the order of the INSERTS it is not the correct. What PG_DUMP does is to add the CONSTRAINTS after doing the INSERTS. There is a way to have the correct order of the INSERTS? I have tested the COPY but does not insert

[GENERAL] postgres

2010-01-24 Thread Amy Smith
All how to get rid of the postmaster that is still running, but I deleted the $PGDATA cluster file, so it can not stop it. but I can not use the port again for new cluster. PLEASAE HELP. Amy

[GENERAL] port question

2010-01-24 Thread Amy Smith
I have installed a v8.4 and first port using localhost is ok. but the second one using different port will get error when connect using IP address. Is that only one port is allowed for one server ? please help - need expert's advice. thanks Amy

Re: [GENERAL] port question

2010-01-24 Thread John R Pierce
Amy Smith wrote: I have installed a v8.4 and first port using localhost is ok. but the second one using different port will get error when connect using IP address. Is that only one port is allowed for one server ? please help - need expert's advice. you can run different instances of

Re: [GENERAL] Recursion in triggers?

2010-01-24 Thread Tom Lane
Gauthier, Dave dave.gauth...@intel.com writes: Ya, I worded the original poorley. Let me try again The after update trigger on the table sets some of the NEW.column values for record A. Then it executes another update on the same table, but on record B. That second execution of the

Fwd: [GENERAL] [LibPQ] Trying PQconnectStart: it doesn't seem to connect

2010-01-24 Thread Alessandro Agosto
From: Alessandro Agosto the.6o...@gmail.com Date: 2010/1/24 Subject: Re: [GENERAL] [LibPQ] Trying PQconnectStart: it doesn't seem to connect To: Craig Ringer cr...@postnewspapers.com.au Hi, thank you for your reply. 2010/1/24 Craig Ringer cr...@postnewspapers.com.au What's wrong with psycopg2

Re: Fwd: [GENERAL] [LibPQ] Trying PQconnectStart: it doesn't seem to connect

2010-01-24 Thread Daniel Verite
Alessandro Agosto wrote: I'm not yet within select/poll cycle, this is the first call that should return CONNECTION_OK or CONNECTION_BAD (refering to docs). That would be the behavior of PQconnectdb(), not PQconnectStart(). Have you read that part of the doc: quote Other states might

Re: [GENERAL] \dt+ sizes don't include TOAST data

2010-01-24 Thread Tom Lane
Greg Smith g...@2ndquadrant.com writes: Florian Weimer wrote: The sizes displayed by \dt+ in version 8.4.2 do not take TOAST tables into account, presumably because the pg_relation_size does not reflect that, either. I think this is a bit surprising. From a user perspective, these are part

Re: [GENERAL] \dt+ sizes don't include TOAST data

2010-01-24 Thread Alvaro Herrera
Tom Lane wrote: Greg Smith g...@2ndquadrant.com writes: Florian Weimer wrote: The sizes displayed by \dt+ in version 8.4.2 do not take TOAST tables into account, presumably because the pg_relation_size does not reflect that, either. I think this is a bit surprising. From a user

[GENERAL] 100% of CPU utilization postgres process

2010-01-24 Thread Hashimoto Yuya
Hello, I observed the event that CPU utilization of the process related to postgres records almost 100% for unknown reason. It would be appreciated if any of you provide any information on this. The following line is a part of the result of ps -auxeww.

Re: [GENERAL] 100% of CPU utilization postgres process

2010-01-24 Thread John R Pierce
Hashimoto Yuya wrote: -Postgres version : PostgreSQL 8.3.3 on i386-portbld-freebsd7.0, compiled by GCC cc (GCC) 4.2.1 20070719 [FreeBSD] 8.3.3 is fairly old, they are up to 8.3.9 in that version. seee the release notes for each version from 8.3.4 to 8.3.9 to see what bugs were fixed...

[GENERAL] Postgresql HA on MSCS over VMWARE

2010-01-24 Thread Steeles
As title, please help. I want to setup Postgresql HA by MSCS in VMWARE platform. (win server 2003, PG 8.3 on 32 bit) MSCS has been setup, the problem can't start postgresql service. PGDATA is on the shared disk. I tried generic service, and application, either one won't bring up postgresql

Re: [GENERAL] 100% of CPU utilization postgres process

2010-01-24 Thread Tom Lane
Hashimoto Yuya hill_cl...@hotmail.com writes: [ lots of time spent by stats collector process ] How large is $PGDATA/global/pgstat.stat ? If it's very large (many MB), try doing pg_stats_reset(). If that makes the stats collector CPU usage drop, consider an update to PG 8.4.x, which is more

Re: [GENERAL] 100% of CPU utilization postgres process

2010-01-24 Thread Hashimoto Yuya
8.3.3 is fairly old, they are up to 8.3.9 in that version. seee the release notes for each version from 8.3.4 to 8.3.9 to see what bugs were fixed... http://www.postgresql.org/docs/current/static/release.html Thanks, I was planning to update the postgres to the newer version, but I

Re: [GENERAL] 100% of CPU utilization postgres process

2010-01-24 Thread Hashimoto Yuya
Thanks, How large is $PGDATA/global/pgstat.stat ? Unfortunately, the size of pgstat.stat was not taken when the CPU utilization of the postgress process reached nearly 100%... If it's very large (many MB), try doing pg_stats_reset(). If that makes the stats collector CPU usage

[GENERAL] Updates: all or partial records

2010-01-24 Thread Paul M Foster
Scenario: You have to update a record. One or more fields are unchanged from the original record being altered. So you have two options: 1) Include those fields in your UPDATE statement, even though they are unchanged; 2) Omit unchanged fields from the UPDATE statement. My first inclination is to

Re: [GENERAL] Variadic polymorpic functions

2010-01-24 Thread Vincenzo Romano
2010/1/23 Pavel Stehule pavel.steh...@gmail.com: 2010/1/22 Vincenzo Romano vincenzo.rom...@notorand.it: 2010/1/22 Tom Lane t...@sss.pgh.pa.us: Vincenzo Romano vincenzo.rom...@notorand.it writes: 2010/1/22 Tom Lane t...@sss.pgh.pa.us: regression=# CREATE FUNCTION q( fmt text, variadic args any

Re: [GENERAL] Postgresql HA on MSCS over VMWARE

2010-01-24 Thread Magnus Hagander
On Monday, January 25, 2010, Steeles stee...@gmail.com wrote: As title, please help. I want to setup Postgresql HA by MSCS in VMWARE platform. (win server 2003, PG 8.3 on 32 bit) MSCS has been setup, the problem can't start postgresql service. PGDATA is on the shared disk. I tried

Re: [GENERAL] Updates: all or partial records

2010-01-24 Thread John R Pierce
Paul M Foster wrote: Scenario: You have to update a record. One or more fields are unchanged from the original record being altered. So you have two options: 1) Include those fields in your UPDATE statement, even though they are unchanged; 2) Omit unchanged fields from the UPDATE statement. My

Re: [GENERAL] Variadic polymorpic functions

2010-01-24 Thread Pavel Stehule
2010/1/25 Vincenzo Romano vincenzo.rom...@notorand.it: 2010/1/23 Pavel Stehule pavel.steh...@gmail.com: 2010/1/22 Vincenzo Romano vincenzo.rom...@notorand.it: 2010/1/22 Tom Lane t...@sss.pgh.pa.us: Vincenzo Romano vincenzo.rom...@notorand.it writes: 2010/1/22 Tom Lane t...@sss.pgh.pa.us:

Re: [GENERAL] Variadic polymorpic functions

2010-01-24 Thread Vincenzo Romano
2010/1/25 Pavel Stehule pavel.steh...@gmail.com: 2010/1/25 Vincenzo Romano vincenzo.rom...@notorand.it: 2010/1/23 Pavel Stehule pavel.steh...@gmail.com: 2010/1/22 Vincenzo Romano vincenzo.rom...@notorand.it: 2010/1/22 Tom Lane t...@sss.pgh.pa.us: Vincenzo Romano vincenzo.rom...@notorand.it

Re: [GENERAL] Variadic polymorpic functions

2010-01-24 Thread Pavel Stehule
2010/1/25 Vincenzo Romano vincenzo.rom...@notorand.it: 2010/1/25 Pavel Stehule pavel.steh...@gmail.com: 2010/1/25 Vincenzo Romano vincenzo.rom...@notorand.it: 2010/1/23 Pavel Stehule pavel.steh...@gmail.com: 2010/1/22 Vincenzo Romano vincenzo.rom...@notorand.it: 2010/1/22 Tom Lane