Re: [GENERAL] Recovering a broken database

2005-06-29 Thread Ciprian Popovici
Quoting Tom Lane <[EMAIL PROTECTED]>: > Ciprian Popovici <[EMAIL PROTECTED]> writes: > > That is, a 8.0 which started on a 7.4.2 repository. After noticing, > > I switched back to 7.4.2, but now it gives this error and won't start: > > I think you are omitting some relevant information, like what y

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for

2005-06-29 Thread Sven Willenberger
Tom Lane presumably uttered the following on 06/29/05 19:12: Sven Willenberger <[EMAIL PROTECTED]> writes: I have found the answer/problem. On a hunch I increased maxdsiz to 1.5G in the loader.conf file and rebooted. I ran vacuumdb and watched top as the process proceeded. What I saw was SIZE

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for

2005-06-29 Thread Tom Lane
Sven Willenberger <[EMAIL PROTECTED]> writes: > I have found the answer/problem. On a hunch I increased maxdsiz to 1.5G > in the loader.conf file and rebooted. I ran vacuumdb and watched top as > the process proceeded. What I saw was SIZE sitting at 603MB (which was > 512MB plus another 91MB which

Re: [GENERAL] CVS Build - No Doc

2005-06-29 Thread Tom Lane
Matt Miller <[EMAIL PROTECTED]> writes: > I couldn't find the Red Hat ES4 package that contains the > 'collateindex.pl' script that the build process needs, so I had to go > hunting. Really? In FC3 it's here: $ which collateindex.pl /usr/bin/collateindex.pl $ rpm -qf /usr/bin/collateindex.pl doc

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for

2005-06-29 Thread Sven Willenberger
On Wed, 2005-06-29 at 16:58 -0400, Sven Willenberger wrote: > On Wed, 2005-06-29 at 16:40 -0400, Charles Swiger wrote: > > On Jun 29, 2005, at 4:12 PM, Sven Willenberger wrote: > > [ ... ] > > > Something I have noticed, > > > when the memory error occurs during the psql session (after a failed > >

Re: [GENERAL] Recovering a broken database

2005-06-29 Thread Tom Lane
Ciprian Popovici <[EMAIL PROTECTED]> writes: > That is, a 8.0 which started on a 7.4.2 repository. After noticing, > I switched back to 7.4.2, but now it gives this error and won't start: I think you are omitting some relevant information, like what you did to force the 8.0 postmaster to start in

[GENERAL] rules and table renaming

2005-06-29 Thread Teunis Peters
I'm renaming a table to a live database before it goes REALLY live and ends up on lots of servers. For various reasons I've got various different clients floating around and can't get them all updated synchronously. anyways. How do I make a set of rules to pass insert/update/delete/...

[GENERAL] UNSUBSCRIBE

2005-06-29 Thread John Sidney-Woollett
UNSUBSCRIBE ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [GENERAL] null constraints and defaults

2005-06-29 Thread Alvaro Herrera
On Wed, Jun 29, 2005 at 01:46:46PM -0700, elein wrote: [reformatted] > On Wed, Jun 29, 2005 at 08:25:09PM +, Matt Miller wrote: > > On Wed, 2005-06-29 at 13:04 -0700, elein wrote: > > > default constraint > > > ... > > > elein=# insert into nulldefault values (NULL); > > > ERROR: null value

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for

2005-06-29 Thread Sven Willenberger
On Wed, 2005-06-29 at 16:40 -0400, Charles Swiger wrote: > On Jun 29, 2005, at 4:12 PM, Sven Willenberger wrote: > [ ... ] > > Something I have noticed, > > when the memory error occurs during the psql session (after a failed > > vacuumdb attempt) the memory stays at 600+MB in top (under size) unti

Re: [GENERAL] null constraints and defaults

2005-06-29 Thread Stephan Szabo
On Wed, 29 Jun 2005, elein wrote: > It seems that the not null constraint is applied > before the default constraint if a column is > defined with both default and not null. > > I understand that default should make the > the NOT NULL constraint unnecessary. But still > > Is this the intended

Re: [GENERAL] null constraints and defaults

2005-06-29 Thread elein
Thanks. I understand that much. I want to know if this is the intended behaviour. --elein On Wed, Jun 29, 2005 at 08:25:09PM +, Matt Miller wrote: > On Wed, 2005-06-29 at 13:04 -0700, elein wrote: > > default constraint > > ... > > elein=# insert into nulldefault values (NULL); > > ERROR:

Re: [GENERAL] null constraints and defaults

2005-06-29 Thread Matt Miller
On Wed, 2005-06-29 at 13:04 -0700, elein wrote: > default constraint > ... > elein=# insert into nulldefault values (NULL); > ERROR: null value in column "one" violates not-null constraint I think the idea of a DEFAULT value is to tell the DB what to supply only if you omit the column from the in

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for

2005-06-29 Thread Sven Willenberger
On Wed, 2005-06-29 at 14:59 -0400, Vivek Khera wrote: > On Jun 29, 2005, at 9:01 AM, Sven Willenberger wrote: > > > Unix user root (and any psql superuser) the vacuum runs fine. It is > > when > > the unix user is non-root (e.g. su -l pgsql -c "vacuumdb -a -z") that > > this memory error occurs.

[GENERAL] null constraints and defaults

2005-06-29 Thread elein
It seems that the not null constraint is applied before the default constraint if a column is defined with both default and not null. I understand that default should make the the NOT NULL constraint unnecessary. But still Is this the intended behaviour? create table nulldefault ( one inte

Re: [GENERAL] Need help writing SQL statement

2005-06-29 Thread D A GERM
thank you all for your help. this solved it: SELECT count(*) FROM table where date_part('hour', time_stamp) in (10, 11); Scott Marlowe wrote: On Wed, 2005-06-29 at 13:20, Jeffrey Melloy wrote: D A GERM wrote: I have been trying to write an sql statement that returns the same hours

Re: [GENERAL] how to use pg_dump and then restored onto development server

2005-06-29 Thread Douglas McNaught
"Zlatko Matic" <[EMAIL PROTECTED]> writes: > OK..i get it. It works... > My additional question is: how to incorporate timestamp in dumped file > name ? > Let's say, if we have script: pg_dump -f D:\MYDB_BCP -Fc -c -x -h > localhost -U postgres MYDB, > so that output file is named something like

Re: [GENERAL] how to use pg_dump and then restored onto development server

2005-06-29 Thread Zlatko Matic
OK..i get it. It works... My additional question is: how to incorporate timestamp in dumped file name ? Let's say, if we have script: pg_dump -f D:\MYDB_BCP -Fc -c -x -h localhost -U postgres MYDB, so that output file is named something like MYDB_BCP_2005-29-01, for example. Is that possible?

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for non-root users

2005-06-29 Thread Vivek Khera
On Jun 29, 2005, at 9:01 AM, Sven Willenberger wrote: Unix user root (and any psql superuser) the vacuum runs fine. It is when the unix user is non-root (e.g. su -l pgsql -c "vacuumdb -a -z") that this memory error occurs. All users use the "default" class for login.conf purposes which has not

Re: [GENERAL] CVS Build - No Doc

2005-06-29 Thread Matt Miller
On Wed, 2005-06-29 at 21:31 +0300, Devrim GUNDUZ wrote: > > I couldn't find the Red Hat ES4 package that contains the > > 'collateindex.pl' script that the build process needs > > docbook-style-dsssl-1.78-4 I had installed that package. It looks like problem was I didn't './configure' from the to

Re: [GENERAL] Need help writing SQL statement

2005-06-29 Thread Scott Marlowe
On Wed, 2005-06-29 at 13:20, Jeffrey Melloy wrote: > D A GERM wrote: > > > I have been trying to write an sql statement that returns the same > > hours in a time stamp no matter what the date. > > I can to pull same hours on the the same days but have not been able > > to figure out how to pull

Re: [GENERAL] Passing a table name to a function for dynamic queries....

2005-06-29 Thread Richard Huxton
Greg Patnude wrote: I know I've seen the answer to this here before but cannot seem to find it Can anyone give me the quick & dirty answer to passing a table name to a function like this: CREATE OR REPLACE FUNCTION tbl_toarray(name) RETURNS text Build the query as text and use EXECUTE t

Re: [GENERAL] CVS Build - No Doc

2005-06-29 Thread Matt Miller
>> How do I build the doc? > http://developer.postgresql.org/docs/postgres/docguide-build.html That worked. I couldn't find the Red Hat ES4 package that contains the 'collateindex.pl' script that the build process needs, so I had to go hunting. I got that Perl script at http://www.ibiblio.org/g

Re: [GENERAL] CVS Build - No Doc

2005-06-29 Thread Devrim GUNDUZ
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, On Wed, 29 Jun 2005, Matt Miller wrote: I couldn't find the Red Hat ES4 package that contains the 'collateindex.pl' script that the build process needs, so I had to go hunting. [EMAIL PROTECTED] ~]# cat /etc/redhat-release Red Hat Enterprise

Re: [GENERAL] Need help writing SQL statement

2005-06-29 Thread Jeffrey Melloy
D A GERM wrote: I have been trying to write an sql statement that returns the same hours in a time stamp no matter what the date. I can to pull same hours on the the same days but have not been able to figure out how to pull all the same hours no matter what the date. Here is the one sql stat

[GENERAL] how use pg_dump/pg_restore

2005-06-29 Thread Ketan S Shah
Hi,  All ,     I am newbie to postgres database. How to take pg_dump from production database and restore into development server using pg_restore..   From documentation, I find that I have to use pg_dump for backup and pg_restore for restoration.   My database name is otsdb..   Fo

[GENERAL] Passing a table name to a function for dynamic queries....

2005-06-29 Thread Greg Patnude
I know I've seen the answer to this here before but cannot seem to find it Can anyone give me the quick & dirty answer to passing a table name to a function like this: CREATE OR REPLACE FUNCTION tbl_toarray(name) RETURNS text $BODY$ DECLARE ROW RECORD; BEGIN SELECT ARRAY(SELECT ''id:

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for

2005-06-29 Thread Sven Willenberger
On Wed, 2005-06-29 at 11:21 -0400, Tom Lane wrote: > Sven Willenberger <[EMAIL PROTECTED]> writes: > > ERROR: out of memory > > DETAIL: Failed on request of size 536870910. > > That's a server-side failure ... > > > Again, if I log in as myself and try to run > > the command vaccumdb -a -z it f

Re: [GENERAL] Advice on merging two primary keys...

2005-06-29 Thread Stephan Szabo
On Wed, 29 Jun 2005, Eric D Nielsen wrote: > > Stephan Szabo wrote: > > On Wed, 29 Jun 2005, Richard Huxton wrote: > > > Eric D. Nielsen wrote: > > > > I've come into a situation where I will often need to merge two primary > > > > keys, with numerous foreign keys hanging off of them. For instanc

[GENERAL] Recovering a broken database

2005-06-29 Thread Ciprian Popovici
Hello, I'm having the almost exact problem described here: http://archives.postgresql.org/pgsql-admin/2004-12/msg00110.php That is, a 8.0 which started on a 7.4.2 repository. After noticing, I switched back to 7.4.2, but now it gives this error and won't start: FATAL: database files are incompat

Re: [GENERAL] how to use pg_dump and then restored onto development server

2005-06-29 Thread Douglas McNaught
"Zlatko Matic" <[EMAIL PROTECTED]> writes: > Concerning this question about pg_dump, I'm also confused and don't > understand when to use pg_restore and when to use psql ? > For example, how to restore in these two cases: > A) pg_dump -f D:\MYDB_BCP -c -x -h localhost -U postgres MYDB > B) pg_dump

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for

2005-06-29 Thread Tom Lane
Sven Willenberger <[EMAIL PROTECTED]> writes: > ERROR: out of memory > DETAIL: Failed on request of size 536870910. That's a server-side failure ... > Again, if I log in as myself and try to run > the command vaccumdb -a -z it fails; if I su to root and repeat it works > fine. I am trying to na

Re: [GENERAL] CVS Build - No Doc

2005-06-29 Thread Tom Lane
Matt Miller <[EMAIL PROTECTED]> writes: > How do I build the doc? http://developer.postgresql.org/docs/postgres/docguide-build.html regards, tom lane ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] how to use pg_dump and then restored onto development server

2005-06-29 Thread Douglas McNaught
ketan shah <[EMAIL PROTECTED]> writes: > Hi, > > All , > > I am newbie to postgres database. How to take pg_dump from production > database and restore into development server using pg_restore.. > > From documentation, I find that I have to use pg_dump for backup and > pg_restore for restoratio

Re: [GENERAL] how to use pg_dump and then restored onto development server

2005-06-29 Thread Zlatko Matic
Concerning this question about pg_dump, I'm also confused and don't understand when to use pg_restore and when to use psql ? For example, how to restore in these two cases: A) pg_dump -f D:\MYDB_BCP -c -x -h localhost -U postgres MYDB B) pg_dump -f D:\MYDB_BCP -Fc -c -x -h localhost -U pos

[GENERAL] Character conversion...

2005-06-29 Thread FC
I have all my database encoded in ISO-8859-1 and I would like to convert this database in UNICODE. I have try this but with no success. pg_dump dbase > foo.db createdb -E UNICODE dbase psql dbase < foo.db I have also try to modify the value of client_encoding in the foo.db file but that d

[GENERAL] Need help writing SQL statement

2005-06-29 Thread D A GERM
I have been trying to write an sql statement that returns the same hours in a time stamp no matter what the date. I can to pull same hours on the the same days but have not been able to figure out how to pull all the same hours no matter what the date. Here is the one sql statement I have been

Re: [GENERAL] Advice on merging two primary keys...

2005-06-29 Thread Eric D Nielsen
> Stephan Szabo wrote: > On Wed, 29 Jun 2005, Richard Huxton wrote: > > Eric D. Nielsen wrote: > > > I've come into a situation where I will often need to merge two primary > > > keys, with numerous foreign keys hanging off of them. For instance: > > > [ snip ] > > > While any update of the either

[GENERAL] how to use pg_dump and then restored onto development server

2005-06-29 Thread ketan shah
Hi,  All ,   I am newbie to postgres database. How to take pg_dump from production database and restore into development server using pg_restore.. From documentation, I find that I have to use pg_dump for backup and pg_restore for restoration. My database name is otsdb..  For backup…I use comm

Re: [GENERAL] faking writable views as tables

2005-06-29 Thread David Fetter
On Wed, Jun 29, 2005 at 01:56:04PM +0200, Enrico Weigelt wrote: > > Hi folks, > > > I'm using several writable views (-> update & insert rules) > and got trouble with pgadmin - it refuses to insert/edit > values since it sees the table as a view and believes views > are never writable. That

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for non-root users

2005-06-29 Thread Douglas McNaught
Sven Willenberger <[EMAIL PROTECTED]> writes: > Again, if I log in as myself and try to run > the command vaccumdb -a -z it fails; if I su to root and repeat it works > fine. I am trying to narrow this down to a PostgreSQL issue vs FreeBSD > issue. That's really weird, b

[GENERAL] Memory tuning for linux (Suffering CRS...)

2005-06-29 Thread Peter L. Berghold
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Folks, I remember seeing somewhere a document that outlined how to tune memory for optimal operation of a postgres server on Linux. I can't seem to find that document again. I did fine one for the 7.x family but not 8.x and I'm currently running 8.x

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for

2005-06-29 Thread Sven Willenberger
On Wed, 2005-06-29 at 09:43 -0400, Douglas McNaught wrote: > Sven Willenberger <[EMAIL PROTECTED]> writes: > > > FreeBSD 5.4-Release > > PostgreSQL 8.0.3 > > > > I noticed that the nightly cron consisting of a vacuumdb was failing due > > to "unable to allocate memory". I do have maintenance_mem s

Re: [GENERAL] truncate all tables?

2005-06-29 Thread Doug Bloebaum
On 6/29/05, Zlatko Matić <[EMAIL PROTECTED]> wrote: > > How could I truncate, delete all content of all tables in one step ? You could use a query to generate the statements in psql: \t \o trunc_all.out SELECT 'TRUNCATE ' || table_name || ';' FROM information_schema.tables WHERE table_sche

[GENERAL] CVS Build - No Doc

2005-06-29 Thread Matt Miller
Yesterday I checked out a cvs copy and I: ./configure make make install as usual. The database works, but the installation has no doc directory. I prefer to read the doc locally. How do I build the doc? The source tree has a doc directory containing what looks to be the sgml source, but I app

Re: [GENERAL] PostgreSQL's vacuumdb fails to allocate memory for non-root users

2005-06-29 Thread Douglas McNaught
Sven Willenberger <[EMAIL PROTECTED]> writes: > FreeBSD 5.4-Release > PostgreSQL 8.0.3 > > I noticed that the nightly cron consisting of a vacuumdb was failing due > to "unable to allocate memory". I do have maintenance_mem set at 512MB, > and the /boot/loader.conf file sets the max datasize to 1G

Re: [GENERAL] Explain Analyse never returns .. maybe a bug

2005-06-29 Thread Douglas McNaught
David Gagnon <[EMAIL PROTECTED]> writes: > Hi all, > > I stop the following statement after 3 minutes > >explain analyse select * > From IC > where IC.ICNUM NOT IN (select IRICNUM from IR WHERE IRSTATUT > in (1, 2)) > > > I'm using 8.0.3 on windows. > > Is that a

Re: [GENERAL] Explain Analyse never returns .. maybe a bug

2005-06-29 Thread Michael Fuhr
On Wed, Jun 29, 2005 at 09:25:24AM -0400, David Gagnon wrote: > > I stop the following statement after 3 minutes > > explain analyse select * >From IC >where IC.ICNUM NOT IN (select IRICNUM from IR WHERE IRSTATUT in > (1, 2)) What does EXPLAIN without ANALYZE show? What

Re: [GENERAL] Explain Analyse never returns .. maybe a bug

2005-06-29 Thread Sean Davis
- Original Message - From: "David Gagnon" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, June 29, 2005 9:25 AM Subject: [GENERAL] Explain Analyse never returns .. maybe a bug Hi all, I stop the following statement after 3 minutes explain analyse select * From IC whe

Re: [GENERAL] 8.1 Out parameter question

2005-06-29 Thread Michael Fuhr
On Tue, Jun 28, 2005 at 02:39:59PM -0500, Tony Caduto wrote: > Will it be possible to use the out params to return more than one row? > > will the params act as a composite type so they can be used in a set > returning function? See "RETURN NEXT" in the PL/pgSQL chapter of the development docume

[GENERAL] Explain Analyse never returns .. maybe a bug

2005-06-29 Thread David Gagnon
Hi all, I stop the following statement after 3 minutes explain analyse select * From IC where IC.ICNUM NOT IN (select IRICNUM from IR WHERE IRSTATUT in (1, 2)) I'm using 8.0.3 on windows. Is that a know bug ? Thanks /David P.S.: I can send more info if needed.

[GENERAL] faking writable views as tables

2005-06-29 Thread Enrico Weigelt
Hi folks, I'm using several writable views (-> update & insert rules) and got trouble with pgadmin - it refuses to insert/edit values since it sees the table as a view and believes views are never writable. So i've just set the reltype in pg_class to 'r'. The frontends now see it as a writeb

[GENERAL] PostgreSQL's vacuumdb fails to allocate memory for non-root users

2005-06-29 Thread Sven Willenberger
FreeBSD 5.4-Release PostgreSQL 8.0.3 I noticed that the nightly cron consisting of a vacuumdb was failing due to "unable to allocate memory". I do have maintenance_mem set at 512MB, and the /boot/loader.conf file sets the max datasize to 1GB (verified by limit). The odd thing is that if I run the

Re: [GENERAL] Advice on merging two primary keys...

2005-06-29 Thread Stephan Szabo
On Wed, 29 Jun 2005, Richard Huxton wrote: > Eric D. Nielsen wrote: > > I've come into a situation where I will often need to merge two primary > > keys, with numerous foreign keys hanging off of them. For instance: > > > While any update of the either primary key will cascade to all relevant

Re: [GENERAL] Foreign key to a view (UNION of two or more tables),

2005-06-29 Thread Enrico Weigelt
* Karl O. Pinc <[EMAIL PROTECTED]> wrote: > So the problem then is that there are codes (e.g. cities) that are > used by multiple questions, sometimes optional or N/A is allowed > and sometimes not. For such cases you could introduce another layer, like a datatype. Each question can be answered

Re: [GENERAL] truncate all tables?

2005-06-29 Thread Michael Glaesemann
On Jun 29, 2005, at 7:04 PM, Richard Huxton wrote: Zlatko Matić wrote: How could I truncate, delete all content of all tables in one step ? Something like this? pg_dump --schema-only mydb > mydb.schema.dump dropdb mydb psql -f mydb.schema.dump mydb That's nice! Michael Glaesemann grzm

Re: [GENERAL] rule as on insert to view with multiple fk referencing the same table

2005-06-29 Thread Enrico Weigelt
* Joan Picanyol <[EMAIL PROTECTED]> wrote: > create table a (id serial not null primary key, data int); > create table b (id serial not null primary key, data int\ > ref1 int references a not null, ref2 int references a not null,\ > ref3 int references a); > create view vw (data_a, da

Re: [GENERAL] truncate all tables?

2005-06-29 Thread Richard Huxton
Zlatko Matić wrote: How could I truncate, delete all content of all tables in one step ? Something like this? pg_dump --schema-only mydb > mydb.schema.dump dropdb mydb psql -f mydb.schema.dump mydb -- Richard Huxton Archonet Ltd ---(end of broadcast)-

Re: [GENERAL] truncate all tables?

2005-06-29 Thread Michael Glaesemann
On Jun 29, 2005, at 6:34 PM, Zlatko Matić wrote: How could I truncate, delete all content of all tables in one step ? The PostgreSQL documentation is quite good. I recommend looking through it. http://www.postgresql.org/docs/8.0/interactive/index.html In particular, here: http://www.post

Re: [GENERAL] automating backup ?

2005-06-29 Thread Zlatko Matic
Hi. Yes, you were right. I added lines for template0 and template1 into pgpass.conf file and now it works. I'm wondering how to include timestamp in backup file name ? - Original Message - From: "Andreas" <[EMAIL PROTECTED]> To: "Zlatko Matic" <[EMAIL PROTECTED]> Cc: Sent: Wednesday

Re: [GENERAL] automating backup ?

2005-06-29 Thread Zlatko Matic
Mike, you have: pg_dump -f Name-Of-My-Dump-File -Fc -Z 9 -h localhost -U myUserName myDBname How do you exactly restore it ? By pg_restore or psql ? What parameters ? - Original Message - From: "Relyea, Mike" <[EMAIL PROTECTED]> To: "Zlatko Matic" <[EMAIL PROTECTED]>; Sent: Tuesday,

[GENERAL] truncate all tables?

2005-06-29 Thread Zlatko Matić
How could I truncate, delete all content of all tables in one step ?

Re: [GENERAL] Connection local variables?

2005-06-29 Thread Richard Huxton
Steve - DND wrote: Is there a way to create a variable specific to the current working connection? Like a connection context or some such? I'm trying to take a variable in a query, and allow it to be used by a rule. You can create functions in a language that allows global storage. Search in t

Re: [GENERAL] Advice on merging two primary keys...

2005-06-29 Thread Richard Huxton
Eric D. Nielsen wrote: I've come into a situation where I will often need to merge two primary keys, with numerous foreign keys hanging off of them. For instance: While any update of the either primary key will cascade to all relevant tables, such an update is disallowed for uniqueness rea