[GENERAL] PostgreSQL contrib 9.2.x

2012-12-13 Thread a...@hsk.hk
Hi, I am using Ubuntu 12.04, I have used installer to install PostgreSQL 9.2.1, the contrib modules are not installed together with the core. I tried to run: sudo apt-get install postgresql-contrib The following packages were automatically installed and are no longer required:

Re: [GENERAL] Read recover rows

2012-12-13 Thread Alvaro Herrera
Alejandro Carrillo escribió: > Hi, > > 1) Anybody knows how to create a table using a table > file? It isn't a fdw, is a file that compose the table in postgresql and > get with the pg_relation_filepath function. Ex: >   >  select pg_relation_filepath('pg_proc'); Make sure the server is down an

Re: [GENERAL] initdb error

2012-12-13 Thread Amitabh Kant
On Fri, Dec 14, 2012 at 3:10 AM, David Noel wrote: > On 12/13/12, Tom Lane wrote: > > David Noel writes: > >> /zdb is a zfs volume I've created for cvs and postgres. > > > > zfs eh? What happens if you point initdb at a non-zfs volume? > > > > (I"m wondering if zfs has issues with the O_DIRECT

Re: [GENERAL] Monitoring streaming replication from standby on Windows

2012-12-13 Thread Karl Denninger
On 12/13/2012 7:36 PM, Yamen LA wrote: > Hello, > > I would like to know how to check the status of the streaming > replication from standby server on Windows. Apparently from the master > I can use the pg table "pg_stat_replication". This table is, however, > empty on the standby since it contains

[GENERAL] Monitoring streaming replication from standby on Windows

2012-12-13 Thread Yamen LA
Hello, I would like to know how to check the status of the streaming replication from standby server on Windows. Apparently from the master I can use the pg table "pg_stat_replication". This table is, however, empty on the standby since it contains information about WAL sender processes and no

Re: [GENERAL] pg_restore error with out of memory

2012-12-13 Thread Kevin Grittner
AI Rumman wrote: I am going to restore a 6 Gb database in my development machine which is running on Centos 5.6 with memory 1 GB. > pg_restore: out of memory > pg_restore: finished item 8570 TABLE DATA entity > pg_restore: [archiver] worker process failed: exit code 1 > I set postgresql.conf as

Re: [GENERAL] Read recover rows

2012-12-13 Thread Adrian Klaver
On 12/13/2012 03:41 PM, Alejandro Carrillo wrote: Are you trying to recover a table by copying in a table from somewhere else? Yes because I can't modify the original file You will not be able to work with the disk file directly, you will need to go through the database. Have you tried pg_du

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-13 Thread Edson Richter
Em 13/12/2012 20:10, Merlin Moncure escreveu: On Thu, Dec 13, 2012 at 1:54 PM, Edson Richter wrote: Has anyone created a XML Schema that would represent PostgreSQL database with all (or at least, major) structures? no -- furthermore, why would you want to? what would be the consumer of this '

Re: [GENERAL] Read recover rows

2012-12-13 Thread Alejandro Carrillo
Are you trying to recover a table by copying in a table from somewhere else? Yes because I can't modify the original file > > De: Adrian Klaver >Para: Alejandro Carrillo >CC: "pgsql-general@postgresql.org" >Enviado: Jueves 13 de diciembre de 2012 18:39 >Asunto

Re: [GENERAL] Read recover rows

2012-12-13 Thread Adrian Klaver
On 12/13/2012 03:30 PM, Alejandro Carrillo wrote: I have a file CALLED 11649 in the path: %PG_DATA%\base\11912 This file is a table data in postgresql. Ex: pg_proc. Now I copied this file, renamed it and I want to connect this file to another new table with the same structure and data. How I can

Re: [GENERAL] Read recover rows

2012-12-13 Thread Alejandro Carrillo
I have a file CALLED 11649 in the path: %PG_DATA%\base\11912 This file is a table data in postgresql. Ex: pg_proc. Now I copied this file, renamed it and I want to connect this file to another new table with the same structure and data. How I can do this? > > De

Re: [GENERAL] Read recover rows

2012-12-13 Thread Adrian Klaver
On 12/13/2012 03:14 PM, Alejandro Carrillo wrote: Hi, 1) Isn't a script. The file is a table file get using the function pg_relation_filepath: select pg_relation_filepath('pg_proc'); The above does NOT return a file it just returns the file path name. Postgres stores it tables(relations) with

Re: [GENERAL] Read recover rows

2012-12-13 Thread Alejandro Carrillo
Hi, 1) Isn't a script. The file is a table file get using the function pg_relation_filepath: select pg_relation_filepath('pg_proc'); 2) :( help! > > De: Adrian Klaver >Para: Alejandro Carrillo >CC: "pgsql-general@postgresql.org" >Enviado: Jueves 13 de dici

Re: [GENERAL] Read recover rows

2012-12-13 Thread Adrian Klaver
On 12/13/2012 02:23 PM, Alejandro Carrillo wrote: Hi, 1) Anybody knows how to create a table using a table file? It isn't a fdw, is a file that compose the table in postgresql and get with the pg_relation_filepath function. Ex: select pg_relation_filepath('pg_proc'); Not sure what you are a

Re: [GENERAL] execution plan is wrong, or the query ?

2012-12-13 Thread Alex Burkoff
Upgrade to 9.2.2 totally fixed the issue. Thanks again! From: Tom Lane [t...@sss.pgh.pa.us] Sent: Tuesday, December 11, 2012 9:10 AM To: Alex Burkoff Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] execution plan is wrong, or the query ? Alex Burko

[GENERAL] Read recover rows

2012-12-13 Thread Alejandro Carrillo
Hi, 1) Anybody knows how to create a table using a table file? It isn't a fdw, is a file that compose the table in postgresql and get with the pg_relation_filepath function. Ex:    select pg_relation_filepath('pg_proc');   2) Anybody knows a JDBC or a multiplatform code that let read the delete

Re: [GENERAL] XML Schema for PostgreSQL database

2012-12-13 Thread Merlin Moncure
On Thu, Dec 13, 2012 at 1:54 PM, Edson Richter wrote: > Has anyone created a XML Schema that would represent PostgreSQL database > with all (or at least, major) structures? no -- furthermore, why would you want to? what would be the consumer of this 'schema'? merlin -- Sent via pgsql-general

Re: [GENERAL] initdb error

2012-12-13 Thread Adrian Klaver
On 12/13/2012 01:40 PM, David Noel wrote: On 12/13/12, Tom Lane wrote: David Noel writes: /zdb is a zfs volume I've created for cvs and postgres. zfs eh? What happens if you point initdb at a non-zfs volume? (I"m wondering if zfs has issues with the O_DIRECT flag that we'll probably try t

Re: [GENERAL] initdb error

2012-12-13 Thread Tom Lane
David Noel writes: > On 12/13/12, Tom Lane wrote: >> (I"m wondering if zfs has issues with the O_DIRECT flag that we'll >> probably try to use with pg_xlog files.) > I /boot off of a UFS volume so I created a directory there, chown and > chmod'ed it, then ran initdb again. Same error, unfortunat

Re: [GENERAL] initdb error

2012-12-13 Thread David Noel
On 12/13/12, Tom Lane wrote: > David Noel writes: >> /zdb is a zfs volume I've created for cvs and postgres. > > zfs eh? What happens if you point initdb at a non-zfs volume? > > (I"m wondering if zfs has issues with the O_DIRECT flag that we'll > probably try to use with pg_xlog files.) I /boo

Re: [GENERAL] initdb error

2012-12-13 Thread Tom Lane
David Noel writes: > /zdb is a zfs volume I've created for cvs and postgres. zfs eh? What happens if you point initdb at a non-zfs volume? (I"m wondering if zfs has issues with the O_DIRECT flag that we'll probably try to use with pg_xlog files.) regards, tom lane --

Re: [GENERAL] initdb error

2012-12-13 Thread Tom Lane
David Noel writes: > On 12/13/12, Tom Lane wrote: >> You could get more information by using the --noclean switch to prevent >> removal of the datadir after failure, and then having a look at the >> debris. Is there a pg_xlog subdirectory inside /zdb/pgsql/data, and if >> so what permissions has

Re: [GENERAL] initdb error

2012-12-13 Thread David Noel
Unfortunately no luck there. Still stick with the same error. On 12/13/12, David Noel wrote: > On 12/13/12, Adrian Klaver wrote: >> On 12/13/2012 10:47 AM, David Noel wrote: >>> On 12/13/12, Tom Lane wrote: >> >>> ygg:/usr/home/ygg> ll /zdb/pgsql/data/pg_xlog/ >>> total 2 >>> drwx-- 2 pgsq

Re: [GENERAL] initdb error

2012-12-13 Thread David Noel
On 12/13/12, Adrian Klaver wrote: > On 12/13/2012 10:47 AM, David Noel wrote: >> On 12/13/12, Tom Lane wrote: > >> ygg:/usr/home/ygg> ll /zdb/pgsql/data/pg_xlog/ >> total 2 >> drwx-- 2 pgsql wheel 2 Dec 13 12:42 archive_status >> > > Different train of thought, away from permissions. > > H

Re: [GENERAL] How to keep the last row of a data set?

2012-12-13 Thread Chris Angelico
On Fri, Dec 14, 2012 at 7:22 AM, John R Pierce wrote: > On 12/13/2012 5:32 AM, seil...@so-net.net.tw wrote: >> >> I am trying to implement a mechanism that prohibits the last row of a data >> set from being deleted. >> >> CREATE TABLE t1 (c1 INTEGER,c2 INTEGER, PRIMARY KEY (c1,c2)); >> >> INSERT I

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Tom Lane
Paul Jungwirth writes: > Yeah, I agree this is the right answer here, since you're using JDBC. By > the time you get a String from the MySQL driver, it's already in Java's > 2-bytes-per-char format. And the Postgres driver will deal with the > encoding on the output side. So the code I provided wo

Re: [GENERAL] How to keep the last row of a data set?

2012-12-13 Thread Edson Richter
Em 13/12/2012 18:22, John R Pierce escreveu: On 12/13/2012 5:32 AM, seil...@so-net.net.tw wrote: I am trying to implement a mechanism that prohibits the last row of a data set from being deleted. CREATE TABLE t1 (c1 INTEGER,c2 INTEGER, PRIMARY KEY (c1,c2)); INSERT INTO t1 VALUES (1,1),(1,2),(

Re: [GENERAL] How to keep the last row of a data set?

2012-12-13 Thread John R Pierce
On 12/13/2012 5:32 AM, seil...@so-net.net.tw wrote: I am trying to implement a mechanism that prohibits the last row of a data set from being deleted. CREATE TABLE t1 (c1 INTEGER,c2 INTEGER, PRIMARY KEY (c1,c2)); INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(2,1),(2,2),(2,3); Which row is the las

[GENERAL] XML Schema for PostgreSQL database

2012-12-13 Thread Edson Richter
Has anyone created a XML Schema that would represent PostgreSQL database with all (or at least, major) structures? Thanks, Edson -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] pg_restore error with out of memory

2012-12-13 Thread AI Rumman
I am going to restore a 6 Gb database in my development machine which is running on Centos 5.6 with memory 1 GB. During restoration I got error as follows: LOG: checkpoints are occurring too frequently (22 seconds apart) HINT: Consider increasing the configuration parameter "checkpoint_segments

Re: [GENERAL] initdb error

2012-12-13 Thread Adrian Klaver
On 12/13/2012 10:47 AM, David Noel wrote: On 12/13/12, Tom Lane wrote: ygg:/usr/home/ygg> ll /zdb/pgsql/data/pg_xlog/ total 2 drwx-- 2 pgsql wheel 2 Dec 13 12:42 archive_status Different train of thought, away from permissions. How was Postgres installed? Where there any errors du

Re: [GENERAL] initdb error

2012-12-13 Thread Adrian Klaver
On 12/13/2012 10:42 AM, David Noel wrote: You are doing the above as the database user ex:postgres? confirmed: ygg:/usr/home/ygg> whoami pgsql The database user has permissions on /zdb/pgsql/data? confirmed: ygg:/usr/home/ygg> ll /zdb/ total 3 drwxrwxrwx 3 cvswheel 3 Dec 12 15:33 c

Re: [GENERAL] initdb error

2012-12-13 Thread David Noel
On 12/13/12, Tom Lane wrote: > David Noel writes: >> I've tried initdb directly: >> initdb -D /zdb/pgsql/data >> ...and still seem to wind up with the error: >> creating template1 database in /zdb/pgsql/data/base/1 ... FATAL: >> could not open file "pg_xlog/00010001" (log file 0,

Re: [GENERAL] initdb error

2012-12-13 Thread David Noel
> You are doing the above as the database user ex:postgres? confirmed: ygg:/usr/home/ygg> whoami pgsql > The database user has permissions on /zdb/pgsql/data? confirmed: ygg:/usr/home/ygg> ll /zdb/ total 3 drwxrwxrwx 3 cvswheel 3 Dec 12 15:33 cvsroot drwxrwxrwx 2 pgsql wheel 2 Dec 13

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Thomas Kellerer
Emi Lu wrote on 13.12.2012 15:00: Is there a simple way to load UTF8 data in psql to mysql(with latin1 encoding) through JDBC? All you need to do is to query the source database, then use ResultSet.getString() to obtain the data and use a PreparedStatement and PreparedStatement.setString() to

Re: [GENERAL] initdb error

2012-12-13 Thread Amitabh Kant
On Thu, Dec 13, 2012 at 10:05 PM, Tom Lane wrote: > David Noel writes: > > I've tried initdb directly: > > initdb -D /zdb/pgsql/data > > ...and still seem to wind up with the error: > > creating template1 database in /zdb/pgsql/data/base/1 ... FATAL: > > could not open file "pg_xlog/0001

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Paul Jungwirth
> The JDBC drivers will handle all the conversion. > Do NOT manually convert the data. Yeah, I agree this is the right answer here, since you're using JDBC. By the time you get a String from the MySQL driver, it's already in Java's 2-bytes-per-char format. And the Postgres driver will deal with th

Re: [GENERAL] initdb error

2012-12-13 Thread Adrian Klaver
On 12/13/2012 08:35 AM, Tom Lane wrote: David Noel writes: I've tried initdb directly: initdb -D /zdb/pgsql/data ...and still seem to wind up with the error: creating template1 database in /zdb/pgsql/data/base/1 ... FATAL: could not open file "pg_xlog/00010001" (log file 0, segm

Re: [GENERAL] How to keep the last row of a data set?

2012-12-13 Thread Kevin Grittner
Tom Lane wrote: > seil...@so-net.net.tw writes: >> I am trying to implement a mechanism that prohibits the last row >> of a data set from being deleted. > The reason that doesn't work is you marked it "stable", so it > always sees the starting state of the outer query. > > Mind you, even with tha

Re: [GENERAL] initdb error

2012-12-13 Thread Amitabh Kant
On Thu, Dec 13, 2012 at 10:00 PM, Adrian Klaver wrote: > On 12/13/2012 08:18 AM, David Noel wrote: > >> On 12/13/12, Adrian Klaver wrote: >> >>> On 12/13/2012 07:38 AM, David Noel wrote: >>> I'm running into the following error message when running initdb (FreeBSD host):

Re: [GENERAL] initdb error

2012-12-13 Thread Tom Lane
David Noel writes: > I've tried initdb directly: > initdb -D /zdb/pgsql/data > ...and still seem to wind up with the error: > creating template1 database in /zdb/pgsql/data/base/1 ... FATAL: > could not open file "pg_xlog/00010001" (log file 0, > segment 1): No such file or directo

Re: [GENERAL] initdb error

2012-12-13 Thread Adrian Klaver
On 12/13/2012 08:18 AM, David Noel wrote: On 12/13/12, Adrian Klaver wrote: On 12/13/2012 07:38 AM, David Noel wrote: I'm running into the following error message when running initdb (FreeBSD host): ygg# /usr/local/etc/rc.d/postgresql initdb -D /zdb/pgsql/data --debug The files belonging to t

Re: [GENERAL] initdb error

2012-12-13 Thread David Noel
On 12/13/12, Adrian Klaver wrote: > On 12/13/2012 07:38 AM, David Noel wrote: >> I'm running into the following error message when running initdb (FreeBSD >> host): >> >> ygg# /usr/local/etc/rc.d/postgresql initdb -D /zdb/pgsql/data --debug >> The files belonging to this database system will be ow

Re: [GENERAL] How to keep the last row of a data set?

2012-12-13 Thread Tom Lane
seil...@so-net.net.tw writes: > I am trying to implement a mechanism that prohibits the last row of a data > set from being deleted. > The following trigger protects nothing: > CREATE OR REPLACE FUNCTION tfd() RETURNS TRIGGER AS $$ > BEGIN > RAISE NOTICE '%',(SELECT COUNT(*) FROM t1 WHERE

Re: [GENERAL] initdb error

2012-12-13 Thread Adrian Klaver
On 12/13/2012 07:38 AM, David Noel wrote: I'm running into the following error message when running initdb (FreeBSD host): ygg# /usr/local/etc/rc.d/postgresql initdb -D /zdb/pgsql/data --debug The files belonging to this database system will be owned by user "pgsql". This user must also own the

Re: [GENERAL] How to keep the last row of a data set?

2012-12-13 Thread seiliki
> -Original Message- > From: Thomas Markus > Sent: Thu, Dec 13 2012 23:14:21 CST > To: seil...@so-net.net.tw > Subject: Re: [GENERAL] How to keep the last row of a data set? > > Hi, > > create an after delete trigger with > > IF (SELECT 1 FROM t1 limit 1) is null THEN > RAISE EXCE

[GENERAL] initdb error

2012-12-13 Thread David Noel
I'm running into the following error message when running initdb (FreeBSD host): ygg# /usr/local/etc/rc.d/postgresql initdb -D /zdb/pgsql/data --debug The files belonging to this database system will be owned by user "pgsql". This user must also own the server process. The database cluster will b

Re: [GENERAL] How to keep the last row of a data set?

2012-12-13 Thread Thomas Markus
Hi, create an after delete trigger with IF (SELECT 1 FROM t1 limit 1) is null THEN RAISE EXCEPTION 'Must keep at least 1 row'; hth Thomas -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Emi Lu
I don't think your Java code does what you think it does. You should read some more about how Java handles string encodings. Here is a method I wrote some years ago that might also help you. It converts streams, not strings, but what you need should be pretty close (and simpler): /** * Inte

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Edson Richter
Em 13/12/2012 12:00, Emi Lu escreveu: Is there a simple way to load UTF8 data in psql to mysql(with latin1 encoding) through JDBC? All you need to do is to query the source database, then use ResultSet.getString() to obtain the data and use a PreparedStatement and PreparedStatement.setString(

Re: [GENERAL] JDBC to load UTF8@psql to latin1@mysql

2012-12-13 Thread Emi Lu
Is there a simple way to load UTF8 data in psql to mysql(with latin1 encoding) through JDBC? All you need to do is to query the source database, then use ResultSet.getString() to obtain the data and use a PreparedStatement and PreparedStatement.setString() to insert/update the data on the tar

Re: [GENERAL] Corrupt indexes on slave when using pg_bulkload on master

2012-12-13 Thread wd
We encounter the same problem, and have to change to use copy command On Wed, Dec 5, 2012 at 9:17 PM, James Cowell wrote: > I'm using pg_bulkload to load large amounts of CSV data into a postgres > database hourly. > > This database is replicated to a second node. > > Whenever a bulk load happe

[GENERAL] How to keep the last row of a data set?

2012-12-13 Thread seiliki
I am trying to implement a mechanism that prohibits the last row of a data set from being deleted. CREATE TABLE t1 (c1 INTEGER,c2 INTEGER, PRIMARY KEY (c1,c2)); INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(2,1),(2,2),(2,3); My desired effect: Case 1, Permit this SQL to be executed: DELETE FROM t1

Re: [GENERAL] Corrupt indexes on slave when using pg_bulkload on master

2012-12-13 Thread James Cowell
Hi Jeff,   Thanks again for your reply.   >If there are no constraint violations, do you still see the problem?   Yes, I've stripped it down to an empty table with a 10 row load and the pk index on the secondary node still corrupts.   > Were there any older version on which it worked?   I'm afrai

[GENERAL] Trouble with PQnotifies()

2012-12-13 Thread seiliki
Dear gurus, CREATE OR REPLACE RULE r1i AS ON INSERT TO t1 DO NOTIFY NotifyMe; CREATE OR REPLACE RULE r1u AS ON UPDATE TO t1 DO NOTIFY NotifyMe; CREATE OR REPLACE RULE r1d AS ON DELETE TO t1 DO NOTIFY NotifyMe; The main thread in my Windows application launches several worker threads. Several wor