[GENERAL] Foreign key verification trigger conditions

2009-06-01 Thread j-lists
I have an update statement that affects every row in a given table. For that table it changes the value in a single column, which itself has a foreign key constraint. The table has an additional 9 foreign keys, some of which reference large tables. My expectation would be that only the changed

[GENERAL] Query to find Foreign Key column data type mismatch

2009-06-01 Thread Gurjeet Singh
Hi All, I wanted to find out if both the ends of a foreign key reference were using the same data types, since, in older versions, not having the same data types can lead to Postgres not picking the appropriate index, and in newer versions also it would be beneficial since having same data

Re: [GENERAL] newbie table design question

2009-06-01 Thread Andrew Smith
On Mon, Jun 1, 2009 at 1:25 AM, Tom Lane t...@sss.pgh.pa.us wrote: Andrew Smith laconi...@gmail.com writes: I'm a beginner when it comes to Postgresql, and have a table design question about a project I'm currently working on. I have 1500 data items that need to be copied every minute

[GENERAL] pg_dump table space

2009-06-01 Thread Luca Ferrari
Hi, is there a way to dump an entire database which has a specific table space without having in the sql file any reference to the tablespace? This can be useful when moving the database from one machine to another (that does not use the tablespace). Any way to achieve that with pg_dump?

Re: [GENERAL] pg_dump table space

2009-06-01 Thread John R Pierce
Luca Ferrari wrote: Hi, is there a way to dump an entire database which has a specific table space without having in the sql file any reference to the tablespace? This can be useful when moving the database from one machine to another (that does not use the tablespace). Any way to achieve

[GENERAL] ZFS disk cache

2009-06-01 Thread Scara Maccai
The Solaris ZFS file system is safe with disk write-cache enabled because it issues its own disk cache flush commands Could someone explain? would that mean that I checking the disk cache with format -e on Solaris is not needed if I use ZFS Thanks -- Sent via pgsql-general mailing

Re: [GENERAL] pg_dump table space

2009-06-01 Thread John R Pierce
John R Pierce wrote: Luca Ferrari wrote: Hi, is there a way to dump an entire database which has a specific table space without having in the sql file any reference to the tablespace? This can be useful when moving the database from one machine to another (that does not use the tablespace).

Re: [GENERAL] GRANT all to a super user

2009-06-01 Thread Jasen Betts
On 2009-05-27, Gauthier, Dave dave.gauth...@intel.com wrote: --_000_482E80323A35A54498B8B70FF2B87980040AEFF544azsmsx504amrc_ Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable What is the (is there a) grant command that I can use to create a super use= r

[GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Grzegorz Jaśkiewicz
is there any way currently to convert xml file in format like below, to a table ? foo section ssc id=foo1 foo_data a=1 b=2/ foo_more_data c=a d=b/ /ssc /section section ssc id=foo2 ... /ssc /section section ... /section section ...

Re: [GENERAL] newbie table design question

2009-06-01 Thread Sam Mason
On Sun, May 31, 2009 at 11:54:09PM +0800, Andrew Smith wrote: I'm a beginner when it comes to Postgresql, and have a table design question about a project I'm currently working on. I have 1500 data items that need to be copied every minute from an external system into my database. The items

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Sam Mason
On Mon, Jun 01, 2009 at 10:53:08AM +0100, Grzegorz Jaaakiewicz wrote: is there any way currently to convert xml file in format like below, to a table ? I've had good luck with the xpath support in PG[1] and some variant of the unnest function that's in PG 8.4 (various versions[2] have been

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Grzegorz Jaśkiewicz
xpath is fine, but not when you have 10+ fields to extract ;) -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] PL-Debugger installation problem

2009-06-01 Thread Jasen Betts
On 2009-05-28, Marcos Davi Reis d...@movamaps.com wrote: --0016e6dbdf4d580089046afca05f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hello All, I did install the pgsql 8.3.7 on Ubuntu 8.04 using apt-get, now i need to install pldebugger (edb-debugger) to

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Sam Mason
On Mon, Jun 01, 2009 at 11:22:14AM +0100, Grzegorz Jaaakiewicz wrote: xpath is fine, but not when you have 10+ fields to extract ;) I've got a few views pulling 10 to 15 values out of XML files and it works OK, not amazing performance but for what I'm doing it's no problem. Scaling beyond that

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Pavel Stehule
Hello you can use simple perl parser an sample is on http://www.postgres.cz/index.php/PL/Perlu_-_Untrusted_Perl#Generov.C3.A1n.C3.AD.2C_zpracov.C3.A1n.C3.AD_XML code is in english and perl, description in czech, sorry regards Pavel Stehule 2009/6/1 Grzegorz Jaśkiewicz gryz...@gmail.com:

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Grzegorz Jaśkiewicz
That's one of things pg xml type lacks ... :/ I just need that to get some real xml, and convert to table once, so I should be fine with xpath, but ... heh. This is so ugly. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Pavel Stehule
2009/6/1 Grzegorz Jaśkiewicz gryz...@gmail.com: That's one of things pg xml type lacks ... :/ yes - SQL/XML isn't completed yet http://wiki.postgresql.org/wiki/XML_Support :( I believe so some procedure like xml_to_table should be nice. but plperlu code should be simple (as perl code should

Re: [GENERAL] ZFS disk cache

2009-06-01 Thread Jasen Betts
On 2009-06-01, Scara Maccai m_li...@yahoo.it wrote: The Solaris ZFS file system is safe with disk write-cache enabled because it issues its own disk cache flush commands Could someone explain? this means ZFS cofigured as described is suitable for the postgres data (and *log) directories

Re: [GENERAL] newbie table design question

2009-06-01 Thread Chris Spotts
I just finished doing something very close to this - not quite once per minute, but close. I started off with an array of integers and after about a month of it, I'm having to redesign my way out of it. It would have worked fine, but you just have to be sure that simple searches is all you're

Re: [GENERAL] newbie table design question

2009-06-01 Thread Sam Mason
On Mon, Jun 01, 2009 at 06:53:30AM -0500, Chris Spotts wrote: I just finished doing something very close to this - not quite once per minute, but close. I started off with an array of integers and after about a month of it, I'm having to redesign my way out of it. I've had to go the other way

Re: [GENERAL] newbie table design question

2009-06-01 Thread Grzegorz Jaśkiewicz
one word, horizontal structure. you are trying to sort 1500 colums, instead of creating 1500 rows per entry... -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] INTERVAL SECOND limited to 59 seconds?

2009-06-01 Thread Sebastien FLAESCH
Thank you Tom for looking at this. I would be pleased to help on testing the fix when available. My plan is to store Informix INTERVALs (coming from the 4gl applications we support) into PostgreSQL INTERVALs, and I have a bunch of tests for that... I believe Informix INTERVALs (and related

[GENERAL] ruby connect

2009-06-01 Thread Justin Carrera
Hi, I'm trying to connect ruby to postgres on ubuntu and the only link I found that has the library is down. Does anyone have the postgres library for ruby? Or direct me to it?

Re: [GENERAL] ZFS disk cache

2009-06-01 Thread Greg Smith
On Mon, 1 Jun 2009, Scara Maccai wrote: The Solaris ZFS file system is safe with disk write-cache enabled because it issues its own disk cache flush commands Could someone explain? There are discussion of this with more information at:

Re: [GENERAL] ruby connect

2009-06-01 Thread Richard Huxton
Justin Carrera wrote: Hi, I'm trying to connect ruby to postgres on ubuntu and the only link I found that has the library is down. Details of the link might have helped the other readers on this list. The owner might not know. Does anyone have the postgres library for ruby? Or direct me

Re: [GENERAL] Foreign key verification trigger conditions

2009-06-01 Thread Tom Lane
j-lists jamisonli...@gmail.com writes: I have an update statement that affects every row in a given table. For that table it changes the value in a single column, which itself has a foreign key constraint. The table has an additional 9 foreign keys, some of which reference large tables. My

Re: [GENERAL] pg_dump table space

2009-06-01 Thread Tom Lane
Luca Ferrari fluca1...@infinito.it writes: is there a way to dump an entire database which has a specific table space without having in the sql file any reference to the tablespace? This can be useful when moving the database from one machine to another (that does not use the tablespace).

Re: [GENERAL] ruby connect

2009-06-01 Thread Richard Huxton
Justin Carrera wrote: I will remember that for next time. Thank you for the link. I tried installing the gem but unsuccessful... r...@codeho:/home/justin/Documents/ruby# gem install postgres -- --with-pgsql-include=/opt/PostgreSQL/8.3/include --with-pgsql-lib=/opt/PostgreSQL/8.3/lib

Re: [GENERAL] pg_dump table space

2009-06-01 Thread Alvaro Herrera
Tom Lane wrote: However, this is really just cosmetic, as the dump is set up like this: SET default_tablespace = whatever; CREATE TABLE whichever(...); If tablespace 'whatever' doesn't exist, you'll get an error on the SET but the CREATE will succeed anyway. (I guess this only works

[GENERAL] INSERT RETURNING rule for joined view

2009-06-01 Thread Sava Chankov
I have a view that joins several tables and want to create unconditional INSERT RETURNING rule for it. I succeeded by specifying the RETURNING clause for the first INSERT in the rule, casting NULL for columns that are not present in that table to the correct type: CREATE TABLE a (id SERIAL

[GENERAL] How can I manually alter the statistics for a column?

2009-06-01 Thread Douglas Alan
I'd like to manually alter the statistics for a column, as for the column in question the statistics are causing Postgres to do the wrong thing for my purposes. (I.e., a Seq Scan, rather than an Index Scan.) If someone can tell me how to achieve this, I would quite grateful. Thanks! |ouglas

Re: [GENERAL] INSERT RETURNING rule for joined view

2009-06-01 Thread Tom Lane
Sava Chankov sava.chan...@gmail.com writes: Is there a way to make RETURNING return all view columns? Something like CREATE RULE _insert AS ON INSERT TO j DO INSTEAD( INSERT INTO a (id,name) VALUES (NEW.id, NEW.name); INSERT INTO b (id,surname) VALUES (NEW.id,NEW.surname) RETURNING id,

Re: [GENERAL] newbie table design question

2009-06-01 Thread björn lundin
CREATE TABLE DataImport (   DataImportID serial NOT NULL PRIMARY KEY,   Time timestamp without time zone NOT NULL,   ID_ABC integer NOT NULL,   ID_DEF integer NOT NULL,   ID_HIJ integer NOT NULL,   etc ); Perhaps you want to not use the around the table and column names. It makes them

Re: [GENERAL] newbie table design question

2009-06-01 Thread Scott Marlowe
2009/6/1 björn lundin b.f.lun...@gmail.com: CREATE TABLE DataImport (   DataImportID serial NOT NULL PRIMARY KEY,   Time timestamp without time zone NOT NULL,   ID_ABC integer NOT NULL,   ID_DEF integer NOT NULL,   ID_HIJ integer NOT NULL,   etc ); Perhaps you want to not use the

Re: [GENERAL] INSERT RETURNING rule for joined view

2009-06-01 Thread Merlin Moncure
On Mon, Jun 1, 2009 at 2:35 PM, Tom Lane t...@sss.pgh.pa.us wrote: Sava Chankov sava.chan...@gmail.com writes: Is there a way to make RETURNING return all view columns? Something like CREATE RULE _insert AS ON INSERT TO j DO INSTEAD(  INSERT INTO a (id,name) VALUES (NEW.id, NEW.name);  

Re: [GENERAL] Foreign key verification trigger conditions

2009-06-01 Thread j-lists
Hi Tom, Thank you for pointing out the condition under which this occurs, I had not made the connection that the check was only occurring when the value in the other columns with foreign keys are null. I agree 100% that a strict key equality check that is in general use in the database should not

Re: [GENERAL] xml to table (as oppose to table to xml)

2009-06-01 Thread Scott Bailey
Pavel Stehule wrote: 2009/6/1 Grzegorz Jaśkiewicz gryz...@gmail.com: That's one of things pg xml type lacks ... :/ yes - SQL/XML isn't completed yet http://wiki.postgresql.org/wiki/XML_Support :( I believe so some procedure like xml_to_table should be nice. but plperlu code should be

[GENERAL] Foreign Key question

2009-06-01 Thread Dave Clarke
Hello I have a table that I'm trying to refactor and I'm by no means a SQL expert (apologies if I'm posting to the wrong group). The table in question has a column that allows NULLs. I want to move that column into a separate table and set up a FK reference back to the original table. My question

[GENERAL] pl/pgsql FOUND variables and RULES

2009-06-01 Thread Sven W
I have a volatile function (trigger) that gathers NEW.*, parses them, then inserts a subset of values into a different table. The table is set up as an inherited table where the parent table has a RULE : CREATE RULE myrule AS ON INSERT TO mytable WHERE ( myfield = 100 and myfield 200) DO

Re: [GENERAL] pl/pgsql FOUND variables and RULES

2009-06-01 Thread Tom Lane
Sven W s...@dmv.com writes: I have a volatile function (trigger) that gathers NEW.*, parses them, then inserts a subset of values into a different table. The table is set up as an inherited table where the parent table has a RULE : CREATE RULE myrule AS ON INSERT TO mytable WHERE (

[GENERAL] waiting for ExclusiveLock on extension of relation

2009-06-01 Thread Mason Hale
Hello -- I'm seeing some odd warning in my postgres (8.3.6) logs. 2009-06-01 20:01:59 UTC (10.11.199.136)LOG: process 7070 still waiting for ExclusiveLock on extension of relation 43911 of database 43623 after 1001.240 ms 2009-06-01 20:01:59 UTC (10.11.199.136)LOG: process 7070 acquired

Re: [GENERAL] waiting for ExclusiveLock on extension of relation

2009-06-01 Thread Tom Lane
Mason Hale masonh...@gmail.com writes: I'm seeing some odd warning in my postgres (8.3.6) logs. 2009-06-01 20:01:59 UTC (10.11.199.136)LOG: process 7070 still waiting for ExclusiveLock on extension of relation 43911 of database 43623 after 1001.240 ms Have you looked up the OIDs to see

Re: [GENERAL] pg_stats.avg_width differs by a factor of 4 on different machines

2009-06-01 Thread Craig de Stigter
This query was giving us good-enough results on our old system. The estimates don't have to be absolutely accurate, just ballpark figures. Also we are estimating the size of zipped shapefiles, not textual geometries. Our tests show that such sizes are quite accurate for medium/large datasets when

Re: [GENERAL] pg_stats.avg_width differs by a factor of 4 on different machines

2009-06-01 Thread Tom Lane
Craig de Stigter craig.destig...@koordinates.com writes: Does anyone have any idea why these numbers would be 4 times as big in Postgres 8.3.7 ? It still doesn't make any sense to me that you're getting values larger than the BLCKSZ. If you look into where that's coming from you might get a

Re: [GENERAL] newbie table design question

2009-06-01 Thread Andrew Smith
2009/6/2 björn lundin b.f.lun...@gmail.com CREATE TABLE DataImport ( DataImportID serial NOT NULL PRIMARY KEY, Time timestamp without time zone NOT NULL, ID_ABC integer NOT NULL, ID_DEF integer NOT NULL, ID_HIJ integer NOT NULL, etc ); Perhaps you want to not use

Re: [GENERAL] ruby connect

2009-06-01 Thread Scott Bailey
I’m trying to connect ruby to postgres on ubuntu and the only link I found that has the library is down. Does anyone have the postgres library for ruby? Or direct me to it? Yeah, I think this is an area that we need to address if we want to see wider adoption of Postgres. I started out to