Re: [GENERAL] Help: pg_restore failure

2011-04-15 Thread Edison So
Hello Adrian, Thank you for the reply. I will definitely give it a try on Monday. I am trying to use pg_dump command to backup up each table in the database and restore them one by one using the "-t" option. It is going to be a painful process because 8.1 pg_dump does not have the "exclude" opti

Re: [GENERAL] pgsql 9.0.1 table corruption

2011-04-15 Thread Tom Lane
Benjamin Smith writes: > On Friday, April 15, 2011 09:50:57 AM Tom Lane wrote: >> If you simply unpacked the tar archive and started a postmaster on that, >> you'd be pretty much guaranteed to get a corrupt database. The tar >> archive is not a valid snapshot by itself --- you have to replay >> w

Re: [GENERAL] pgsql 9.0.1 table corruption

2011-04-15 Thread Benjamin Smith
On Friday, April 15, 2011 09:50:57 AM Tom Lane wrote: > If you simply unpacked the tar archive and started a postmaster on that, > you'd be pretty much guaranteed to get a corrupt database. The tar > archive is not a valid snapshot by itself --- you have to replay > whatever WAL was generated duri

Re: [GENERAL] Can a nested function determine it is being called within a trigger?

2011-04-15 Thread Rob Sargent
On 04/15/2011 05:36 PM, Tom Lane wrote: Basil Bourque writes: When a trigger calls a function, that function can determine if it is being called from within a trigger by testing for a value in the special variable "TG_OP". Uh, no, not really. TG_OP is a local variable in the trigger funct

Re: [GENERAL] Can a nested function determine it is being called within a trigger?

2011-04-15 Thread Tom Lane
Basil Bourque writes: > When a trigger calls a function, that function can determine if it is being > called from within a trigger by testing for a value in the special variable > "TG_OP". Uh, no, not really. TG_OP is a local variable in the trigger function; it's not visible from elsewhere.

Re: [GENERAL] Help: pg_restore failure

2011-04-15 Thread Adrian Klaver
On 04/15/2011 01:15 PM, Edison So wrote: I have a DELL server running Windows server 2003 and Postgres 8.1. I used pg_dump to back up a database test: pg_dump -v -h localhost -p 5432 -U postgres -F c -b -f "D:/db_dump/backup.bak" test The backup was showing the following error. . pg_dump: dumpin

[GENERAL] Can a nested function determine it is being called within a trigger?

2011-04-15 Thread Basil Bourque
When a trigger calls a function, that function can determine if it is being called from within a trigger by testing for a value in the special variable "TG_OP". But what if a trigger calls a function that calls a 2nd function via the "PERFORM" command? Can that 2nd function tell if it is being

[GENERAL] Help: pg_restore failure

2011-04-15 Thread Edison So
I have a DELL server running Windows server 2003 and Postgres 8.1. I used pg_dump to back up a database test: pg_dump -v -h localhost -p 5432 -U postgres -F c -b -f "D:/db_dump/backup.bak" test The backup was showing the following error. . pg_dump: dumping contents of table history pg_dump: [cu

Re: [GENERAL] Vacuumdb error

2011-04-15 Thread Tom Lane
Carl von Clausewitz writes: >>> sqlstate=23505ERROR: duplicate key value violates unique constraint >>> "pg_index_indexrelid_index" >>> sqlstate=23505DETAIL: Key (indexrelid)=(2678) already exists. After a considerable amount of fooling around I've been able to reproduce this and identify the c

Re: [GENERAL] How to silence constraint violation logging for an INSERT

2011-04-15 Thread Jerry Sievers
Andrew Sullivan writes: > On Fri, Apr 15, 2011 at 02:04:49PM -0400, Jerry Sievers wrote: > >> set log_min_messages to fatal; > > I thought changing the log_min_messages required superuser access? > (That's what the docs say, and what I'd expect too.) Oops!... Yup. Forgot about that. I'll go ea

Re: [GENERAL] How to silence constraint violation logging for an INSERT

2011-04-15 Thread Andrew Sullivan
On Fri, Apr 15, 2011 at 02:04:49PM -0400, Jerry Sievers wrote: > set log_min_messages to fatal; I thought changing the log_min_messages required superuser access? (That's what the docs say, and what I'd expect too.) A -- Andrew Sullivan a...@crankycanuck.ca -- Sent via pgsql-general mailing l

Re: [GENERAL] How to silence constraint violation logging for an INSERT

2011-04-15 Thread Jerry Sievers
Paul Millar writes: > Hi all, > > I've a question regarding unique constraints, which I've tried to describe in > general terms, to keep things simple. > > I've working on an application that, amongst other things, may add a row to a > table. This table has a primary key defined over two (of t

[GENERAL] Typecast

2011-04-15 Thread Nick Raj
Hi, Can anybody tell me how to typecast data type Point into Datum? Thanks Nick

Re: [GENERAL] pgsql 9.0.1 table corruption

2011-04-15 Thread Tom Lane
Dan Biagini writes: > I have a 9.0.1 database with two corrupted tables (one table has 20 > rows, the other 140). The tables *seem* fine for read/select > operations, but updating certain rows in the table produce error > messages: > update media set updated_at = now() at time zone 'UTC'; > ERRO

Re: [GENERAL] How to silence constraint violation logging for an INSERT

2011-04-15 Thread Merlin Moncure
On Fri, Apr 15, 2011 at 10:55 AM, Paul Millar wrote: > Hi all, > > I've a question regarding unique constraints, which I've tried to describe in > general terms, to keep things simple. > > I've working on an application that, amongst other things, may add a row to a > table.  This table has a prim

Re: [GENERAL] How to silence constraint violation logging for an INSERT

2011-04-15 Thread Andrew Sullivan
On Fri, Apr 15, 2011 at 05:55:07PM +0200, Paul Millar wrote: > > ERROR: duplicate key value violates unique constraint [..] > > The log files may contain many such messages, depending on the usage-pattern > of the end-user. Including all these messages in the log file is distracting. >

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread salah jubeh
Hello Tom Sorry, but I did not get you. I know that the filtering in the where clause and can be pushed up or down in the parsing tree depending on the optimizer. So in this certain case, the result could be computed first and filtered by the where clause later. Regards _

[GENERAL] How to silence constraint violation logging for an INSERT

2011-04-15 Thread Paul Millar
Hi all, I've a question regarding unique constraints, which I've tried to describe in general terms, to keep things simple. I've working on an application that, amongst other things, may add a row to a table. This table has a primary key defined over two (of the three) fields, which forces th

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread Tom Lane
salah jubeh writes: > But, why I can not use the alias of the select statement ( as in the > original > post) in the where clause. The select list can only be computed after the where clause has filtered the rows, so such a thing would be circular. regards, tom l

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread salah jubeh
Hello Harald, Danke ! . My concern is why I get error undefiend attribute if I used the alias in the where clause Regards From: Harald Armin Massa To: salah jubeh Cc: pgsql Sent: Fri, April 15, 2011 5:26:45 PM Subject: Re: [GENERAL] correlated query

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread salah jubeh
Hello All, The following query give me what I want. Select nspname, COALESCE(t_count.count,0) as num_of_tables, COALESCE(v_count.count,0) as num_of_views FROM pg_namespace Left Join (SELECT schemaname, count(*) as count FROM pg_tables group by schemaname) t_count on (t_count.schemana

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread Chris Curvey
On Fri, Apr 15, 2011 at 11:22 AM, salah jubeh wrote: > Hello All, > > I am wondering, why I can not add the following ' A > 10' in the where > clause i.e. 'where nspname !~* 'pg_' and A > 10' > > Select nspname, (SELECT count(*) as count FROM pg_tables where schemaname = > nspname) as A >

Re: [GENERAL] correlated query as a column and where clause

2011-04-15 Thread Harald Armin Massa
> > I am wondering, why I can not add the following ' A > 10' in the where > clause i.e. 'where nspname !~* 'pg_' and A > 10' > > Select nspname, (SELECT count(*) as count FROM pg_tables where schemaname = > nspname) as A > FROM pg_namespace > where nspname !~* 'pg_' > > > what you are look

[GENERAL] correlated query as a column and where clause

2011-04-15 Thread salah jubeh
Hello All, I am wondering, why I can not add the following ' A > 10' in the where clause i.e. 'where nspname !~* 'pg_' and A > 10' Select nspname, (SELECT count(*) as count FROM pg_tables where schemaname = nspname) as A FROM pg_namespace where nspname !~* 'pg_' Thanks in advance

Re: [GENERAL] Migrating Data Across Major Versions

2011-04-15 Thread Adrian Klaver
On Friday, April 15, 2011 7:10:00 am Shawn Gennaria wrote: > > Yes, it's running as a postgres superuser. Unfortunately I didn't > dump the output to a file so I could read it after it exceeds the > terminal's buffer. > > It just dawned on me that I may have misinterpreted the messages. I > ju

Re: [GENERAL] Migrating Data Across Major Versions

2011-04-15 Thread Shawn Gennaria
On Fri, Apr 15, 2011 at 9:32 AM, Adrian Klaver wrote: > On Friday, April 15, 2011 5:25:51 am Shawn Gennaria wrote: >> Hi all, >> >> I'm in the process of migrating our data from 8.4 to 9.0.3 on a >> different server, both running Ubuntu.  My initial attempt involved >> running pg_dumpall (from the

Re: [GENERAL] Compression

2011-04-15 Thread Adrian Klaver
On Thursday, April 14, 2011 9:37:10 pm Craig Ringer wrote: > On 15/04/2011 8:07 AM, Adrian Klaver wrote: > > "EXTENDED allows both compression and out-of-line storage. This is the > > default for most TOAST-able data types. Compression will be attempted > > first, then out-of- > > > > line storage

Re: [GENERAL] Migrating Data Across Major Versions

2011-04-15 Thread Adrian Klaver
On Friday, April 15, 2011 5:25:51 am Shawn Gennaria wrote: > Hi all, > > I'm in the process of migrating our data from 8.4 to 9.0.3 on a > different server, both running Ubuntu. My initial attempt involved > running pg_dumpall (from the 9.0.3 version) on the entire 8.4 cluster, > putting all of t

Re: [GENERAL] Normalize or not?

2011-04-15 Thread Perry Smith
Ah. I'm interfacing to the database via Ruby. So, write a function in pl/pgsql to do an insert, update, and delete that maintain the integrity that I want and then call those via Ruby. On Apr 15, 2011, at 7:59 AM, David Johnston wrote: > More along the lines of pl/pgsql and/or whatever applic

Re: [GENERAL] Normalize or not?

2011-04-15 Thread David Johnston
More along the lines of pl/pgsql and/or whatever application language you are using; not rules. On Apr 15, 2011, at 8:45, Perry Smith wrote: > Mostly, this entire project is for me to learn. What started out as a toy > has gown into something that about 40 people use each day but it is > def

Re: [GENERAL] Normalize or not?

2011-04-15 Thread Perry Smith
Mostly, this entire project is for me to learn. What started out as a toy has gown into something that about 40 people use each day but it is definitely not normal production stress. Or course, I'd like to assume and do things as if it was going to be stressed. For whatever reason, I've done

[GENERAL] Migrating Data Across Major Versions

2011-04-15 Thread Shawn Gennaria
Hi all, I'm in the process of migrating our data from 8.4 to 9.0.3 on a different server, both running Ubuntu. My initial attempt involved running pg_dumpall (from the 9.0.3 version) on the entire 8.4 cluster, putting all of the schemas, data and everything into one giant file. Jumping ahead, I a

Re: [GENERAL] function to filter out tokens (sql syntax lexical)?

2011-04-15 Thread Wim Bertels
On Thu, 2011-04-14 at 16:53 -0400, Tom Lane wrote: > Wim Bertels writes: > > is there a function one could use to filter out the specific tokes? > > In 8.4 and up, pg_get_keywords() might help. indeed something i could use as reference i'm actually looking for a way to compare two sql statement

Re: [GENERAL] How can you have an Exclusive Lock on nothing? please help me understand this lock monitoring query output

2011-04-15 Thread Simon Riggs
On Fri, Apr 15, 2011 at 2:12 AM, Aleksey Tsalolikhin wrote: > Hi.  I use the following query (from > http://wiki.postgresql.org/wiki/Lock_Monitoring) > to monitor locks; and I've got an ExlusiveLock that does not have a relation > name associated with it.  What is locked with the Exclusive Lock i