[GENERAL] Utilities for managing streaming replication servers?

2011-03-23 Thread Toby Corkindale
Hi, I wondered if there were any software packages floating around to manage servers using streaming replication with Pg? ie. To handle failing over and adjusting the config to promote a slave; and performing the steps of syncing and restarting to bring up a new slave. Cheers, Toby -- Sent

[GENERAL] RAID 1 - drive failed - very slow queries even after drive replaced

2011-03-23 Thread Merrick
Hi, I am looking for some advice on where to troubleshoot after 1 drive in a RAID 1 failed. Thank you. I am running v 7.41, I am currently importing the data to another physical server running 8.4 and will test with that once I can. In the meantime here is relevant info: Backups used to take

Re: [GENERAL] Utilities for managing streaming replication servers?

2011-03-23 Thread John R Pierce
On 03/22/11 11:18 PM, Toby Corkindale wrote: Hi, I wondered if there were any software packages floating around to manage servers using streaming replication with Pg? ie. To handle failing over and adjusting the config to promote a slave; and performing the steps of syncing and restarting to

Re: [GENERAL] RAID 1 - drive failed - very slow queries even after drive replaced

2011-03-23 Thread tv
Hi, I am looking for some advice on where to troubleshoot after 1 drive in a RAID 1 failed. Thank you. I am running v 7.41, I am currently importing the data to another physical server running 8.4 and will test with that once I can. In the meantime here is relevant info: Backups used

Re: [GENERAL] Weird problems with C extension and bytea as input type

2011-03-23 Thread Adrian Schreyer
On Tue, Mar 22, 2011 at 22:21, David W Noon dwn...@ntlworld.com wrote: On Tue, 22 Mar 2011 16:14:47 -0500, Merlin Moncure wrote about Re: [GENERAL] Weird problems with C extension and bytea as input type: [snip] On Tue, Mar 22, 2011 at 8:22 AM, Adrian Schreyer ams...@cam.ac.uk wrote: [snip]

Re: [GENERAL] Utilities for managing streaming replication servers?

2011-03-23 Thread Vibhor Kumar
On Mar 23, 2011, at 11:48 AM, Toby Corkindale wrote: I wondered if there were any software packages floating around to manage servers using streaming replication with Pg? ie. To handle failing over and adjusting the config to promote a slave; and performing the steps of syncing and

Re: [GENERAL] Backups with continuous archiving

2011-03-23 Thread Vibhor Kumar
On Mar 22, 2011, at 5:20 AM, runner wrote: A) CREATING FILESSYSTEM SNAPSHOTS - We're snapping the data, wal and archive directories. We only plan on using the data snap and that's just so we can perform the backup faster. Will the wal and archive snapshots be useful for anything?

Re: [GENERAL] Weird problems with C extension and bytea as input type

2011-03-23 Thread Adrian Schreyer
On Tue, Mar 22, 2011 at 22:21, David W Noon dwn...@ntlworld.com wrote: On Tue, 22 Mar 2011 16:14:47 -0500, Merlin Moncure wrote about Re: [GENERAL] Weird problems with C extension and bytea as input type: [snip] On Tue, Mar 22, 2011 at 8:22 AM, Adrian Schreyer ams...@cam.ac.uk wrote: [snip]

[GENERAL] General question

2011-03-23 Thread salah jubeh
Hello, Some times the primary key is the same as the foreign key such as in the following design. which is used to model 1-1 relationship. In the database books, such as database fundamentals(Masri), the 1-1 relation is modeled by having two separate key. when this kind of design (shared

[GENERAL] pg_dump problems

2011-03-23 Thread Martín Marqués
Hi all, I'm having problems with pg_dump, apparently, from one of our servers. The scenario is like this. I tried today to dump a DB from our production server to load on our development server and got some errors, which I show below. Production server: SELECT version();

Re: [GENERAL] pg_dump problems

2011-03-23 Thread Vick Khera
2011/3/23 Martín Marqués martin.marq...@gmail.com: The scenario is like this. I tried today to dump a DB from our production server to load on our development server and got some errors, which I show below. Try using the pg_dump from the 8.4 install to create your dump file. Also make sure

[GENERAL] PostgreSQL documentation specifies 2-element array for float8_accum but 3-element array expected

2011-03-23 Thread Disc Magnet
I was learning how to create my own aggregate functions from http://www.postgresql.org/docs/9.0/static/xaggr.html I copied the avg() example as CREATE TABLE numbers ( value integer ); insert into numbers values (2); insert into numbers values (3); insert into numbers values (4); CREATE

Re: [GENERAL] pg_dump problems

2011-03-23 Thread Martín Marqués
Now I'm getting weirder things. I did a pg_dump with -d option and the dump adds strange caracters: ERROR: error de sintaxis en o cerca de «I» LÍNEA 1: I^NSERT INTO objeto_datos_rep VALUES (1172339, 387943, 'Wilde... Could it be binary corruption (pg_dump for example)? 2011/3/23 Vick Khera

Re: [GENERAL] General question

2011-03-23 Thread David Johnston
The main significant advantage that NOT making the primary key also a foreign key is that you can set the foreign key reference to ON DELETE SET NULL. If they are shared this will not work since a primary key cannot be NULL. However, if you are going to do ON DELETE CASCADE anyway then the

Re: [GENERAL] Weird problems with C extension and bytea as input type

2011-03-23 Thread dennis jenkins
On Wed, Mar 23, 2011 at 5:08 AM, Adrian Schreyer ams...@cam.ac.uk wrote: you are right, it returns a char *. The prototype: char *function(bytea *b); The actual C++ function looks roughly like this extern C char *function(bytea *b) {   string ism;   [...]   return ism.c_str(); }

Re: [GENERAL] PostgreSQL documentation specifies 2-element array for float8_accum but 3-element array expected

2011-03-23 Thread Merlin Moncure
On Wed, Mar 23, 2011 at 8:03 AM, Disc Magnet discmag...@gmail.com wrote: I was learning how to create my own aggregate functions from http://www.postgresql.org/docs/9.0/static/xaggr.html I copied the avg() example as CREATE TABLE numbers (    value integer ); insert into numbers values

Re: [GENERAL] Weird problems with C extension and bytea as input type

2011-03-23 Thread Merlin Moncure
On Wed, Mar 23, 2011 at 9:04 AM, dennis jenkins dennis.jenkins...@gmail.com wrote: On Wed, Mar 23, 2011 at 5:08 AM, Adrian Schreyer ams...@cam.ac.uk wrote: you are right, it returns a char *. The prototype: char *function(bytea *b); The actual C++ function looks roughly like this extern

Re: [GENERAL] Weird problems with C extension and bytea as input type

2011-03-23 Thread Tom Lane
Adrian Schreyer ams...@cam.ac.uk writes: The actual C++ function looks roughly like this extern C char *function(bytea *b) { string ism; [...] return ism.c_str(); } My C++ is pretty rusty, but is the pointer returned by c_str() still valid after the string variable goes out of

Re: [GENERAL] RAID 1 - drive failed - very slow queries even after drive replaced

2011-03-23 Thread Merlin Moncure
On Wed, Mar 23, 2011 at 3:33 AM, Merrick merr...@gmail.com wrote: Hi, I am looking for some advice on where to troubleshoot after 1 drive in a RAID 1 failed. Thank you. I am running v 7.41, I am currently importing the data to another physical server running 8.4 and will test with that

Re: [GENERAL] pg_dump problems

2011-03-23 Thread Adrian Klaver
On Wednesday, March 23, 2011 6:57:35 am Martín Marqués wrote: Now I'm getting weirder things. I did a pg_dump with -d option and the dump adds strange caracters: As previously stated try using the 8.4 version of pg_dump to dump the 8.3 database. FYI in 8.4+ there is no -d option anymore, it

Re: [GENERAL] General question

2011-03-23 Thread salah jubeh
Dear Johnston, Thanks for the reply, I really get a lot of benefit from it. In my design, I have several accounts which share some information at least id an the name. So, I want to make a specialization tree. Also, I want to use the ids as a global Identifiers in different scopes. So, I want

Re: [GENERAL] PostgreSQL documentation specifies 2-element array for float8_accum but 3-element array expected

2011-03-23 Thread Tom Lane
Disc Magnet discmag...@gmail.com writes: CREATE AGGREGATE myavg(float8) ( sfunc = float8_accum, stype = float8[], finalfunc = float8_avg, initcond = '{0,0}' ); On trying to run this, I get this error: cdb=# select myavg(value) from numbers; ERROR: float8_accum: expected

Re: [GENERAL] General question

2011-03-23 Thread David Johnston
What kind of account are we talking about? A user account, an accounting account, a customer account, something else? IF you were to use a non-shared foreign key in the application_account table which primary key would you use within the other tables in the application if you need to refer

Re: [GENERAL] pg_dump problems

2011-03-23 Thread Martín Marqués
El día 23 de marzo de 2011 11:18, Adrian Klaver adrian.kla...@gmail.com escribió: On Wednesday, March 23, 2011 6:57:35 am Martín Marqués wrote: Now I'm getting weirder things. I did a pg_dump with -d option and the dump adds strange caracters: As previously stated try using the 8.4 version

Re: [GENERAL] General question

2011-03-23 Thread salah jubeh
It is a user accounts, which might then become customer accounts, accounting accounts, etc. I will use specialization and generalization concepts in database. I did not complete the design analyses but most probably, I will use shared keys. Regards From:

Re: [GENERAL] General question

2011-03-23 Thread David Johnston
Given what you just describe I would probably associate a new primary key for each sub-type and link to “parent_account”. The polymorphism aspect is fairly severe that using a shared PK is likely to be more confusing than helpful. From: salah jubeh [mailto:s_ju...@yahoo.com] Sent:

Re: [GENERAL] query taking much longer since Postgres 8.4 upgrade

2011-03-23 Thread Davenport, Julie
Here is the explain plan of the new query (same as original but with changes to the Date subquery to use ::date instead of to_char to truncate the time portion), when it is run after doing these 2 sets first: set work_mem='8MB'; set enable_nestloop = false; explain plan (8.4):

[GENERAL] Recursive function that receives a list of IDs and returns all child IDs

2011-03-23 Thread Sven Haag
hello pgsql fans out there, i've already created a function that returns a list of IDs of all sub-samples based on a given sample ID. this works fine. now i like to extend this function so that it can receive a list of sample IDs. e.g.: fn_get_subsamples(IN sample_numbers SETOF integer) here

Re: [GENERAL] Weird problems with C extension and bytea as input type

2011-03-23 Thread Adrian Schreyer
On Wed, Mar 23, 2011 at 14:08, Merlin Moncure mmonc...@gmail.com wrote: On Wed, Mar 23, 2011 at 9:04 AM, dennis jenkins dennis.jenkins...@gmail.com wrote: On Wed, Mar 23, 2011 at 5:08 AM, Adrian Schreyer ams...@cam.ac.uk wrote: you are right, it returns a char *. The prototype: char

Re: [GENERAL] Recursive function that receives a list of IDs and returns all child IDs

2011-03-23 Thread Tom Lane
Sven Haag sven-h...@gmx.de writes: hello pgsql fans out there, i've already created a function that returns a list of IDs of all sub-samples based on a given sample ID. this works fine. now i like to extend this function so that it can receive a list of sample IDs. e.g.:

[GENERAL] Dynamic Assignment

2011-03-23 Thread Andy Chambers
Hi All, In a trigger function, I'm trying to set the variable pkey to be one of the columns in the automatic variable NEW. Which one depends on some metadata that is available at run-time. I'm having a hard time using an automatic variable in a dynamic execute command. I get the error

Re: [GENERAL] Dynamic Assignment

2011-03-23 Thread Pavel Stehule
2011/3/23 Andy Chambers achamb...@mcna.net: Hi All, In a trigger function, I'm trying to set the variable pkey to be one of the columns in the automatic variable NEW.  Which one depends on some metadata that is available at run-time.  I'm having a hard time using an automatic variable in a

Re: [GENERAL] pg_dump problems

2011-03-23 Thread Adrian Klaver
On 03/23/2011 07:56 AM, Martín Marqués wrote: El día 23 de marzo de 2011 11:18, Adrian Klaver adrian.kla...@gmail.com escribió: On Wednesday, March 23, 2011 6:57:35 am Martín Marqués wrote: Now I'm getting weirder things. I did a pg_dump with -d option and the dump adds strange caracters:

Re: [GENERAL] constraint partition issue

2011-03-23 Thread hyelluas
sorry, my table has many columns and missed the datex when make it look smaller. datex is the column in the table. This is the driving constraint. My task is to have 30 days of data with 5mln to 10 mln rec in 1 hour table, so I partition it by hour table and combine them into days, which are

Re: [GENERAL] pg_dump problems

2011-03-23 Thread Martín Marqués
El día 23 de marzo de 2011 14:03, Adrian Klaver adrian.kla...@gmail.com escribió: On 03/23/2011 07:56 AM, Martín Marqués wrote: Ok, did a remote dump (from the development server which has pg 8.4) and I got a similar error: psql:siprebi-bu.sql:27374: ERROR:  sintaxis de entrada no

Re: [GENERAL] Recursive function that receives a list of IDs and returns all child IDs

2011-03-23 Thread Sven Haag
i guess an array is also ok. must been something like: fn_get_subsamples(IN sample_numbers[] integer) ?? how would a query then look like? SELECT * FROM sample WHERE sample_number IN ( fn_get_subsamples(1,2,3,4) ) ?? cheers sven Am 23.03.2011 17:42, schrieb Tom Lane: Sven

Re: [GENERAL] pg_dump problems

2011-03-23 Thread Vick Khera
2011/3/23 Martín Marqués martin.marq...@gmail.com: The second error is very curious, as it looks like pg_dump changed 1 for a 'q' in an integer field: psql:siprebi-bu.sql:2219245: ERROR:  la sintaxis de entrada no es válida para integer: «q721695» CONTEXT:  COPY objeto_datos_rep, línea

Re: [GENERAL] pg_dump problems

2011-03-23 Thread Adrian Klaver
On 03/23/2011 10:33 AM, Martín Marqués wrote: El día 23 de marzo de 2011 14:03, Adrian Klaver adrian.kla...@gmail.com escribió: On 03/23/2011 07:56 AM, Martín Marqués wrote: Ok, did a remote dump (from the development server which has pg 8.4) and I got a similar error:

[GENERAL] Understanding Datum

2011-03-23 Thread Nick Raj
Hi, I am understanding the postgres code. In code, i just want to see what are values that are passing through the variables? Can you please tell me if the variable is of type Datum, then how to print its value? Because i dont the variable v type. And also what the structure of Datum? Thanks,

Re: [GENERAL] RAID 1 - drive failed - very slow queries even after drive replaced

2011-03-23 Thread Merrick
Thank you Merlin, I had my suspicions about the hardware as well. The backup server is blazing fast, it is definitely time to ramble on... On Mar 23, 7:11 am, mmonc...@gmail.com (Merlin Moncure) wrote: On Wed, Mar 23, 2011 at 3:33 AM, Merrick merr...@gmail.com wrote: Hi, I am looking for

[GENERAL] In what cases can SPI_finish crash postgres backend?

2011-03-23 Thread Jorge Arévalo
Hello, I'm writing my own C-function on server side, to extend SQL. One of my function's arguments is any valid PostgreSQL expression returning a number. Another argument is a specific data type (RASTER type). So, if I execute this function against a table with 1000 rows, each row having one

Re: [GENERAL] In what cases can SPI_finish crash postgres backend?

2011-03-23 Thread Pavel Stehule
Hello SPI_finish try to release resources and memory. Maybe you has broken memory. Try to compile postgres with --enable-debug and --enable-cassert flags. You can take more info from core dump. Regards Pavel Stehule 2011/3/23 Jorge Arévalo jorge.arev...@deimos-space.com: Hello, I'm writing

Re: [GENERAL] In what cases can SPI_finish crash postgres backend?

2011-03-23 Thread Jorge Arévalo
2011/3/23 Pavel Stehule pavel.steh...@gmail.com: Hello SPI_finish try to release resources and memory. Maybe you has broken memory. Try to compile postgres with --enable-debug and --enable-cassert flags. You can take more info from core dump. Regards Pavel Stehule Hello Pavel, I'm

Re: [GENERAL] RAID 1 - drive failed - very slow queries even after drive replaced

2011-03-23 Thread Alban Hertroys
On 23 Mar 2011, at 9:33, Merrick wrote: Backups used to take 25 minutes, and now take 110 minutes, before replacing the drive it became clear the backup was not going to finish since in 120 minutes it had only finished 200mb of 2.8gb. A few obvious questions: 1. Are you sure you replaced the

Re: [GENERAL] RAID 1 - drive failed - very slow queries even after drive replaced

2011-03-23 Thread Andrew Sullivan
On Wed, Mar 23, 2011 at 08:08:47PM +0100, Alban Hertroys wrote: er or motherboard? Maybe the new drive has different requirements than the old one had (more power, for example)? Or a newer but backward-plug-compatible interface? Often, the new drive in the old plug only uses the Right

Re: [GENERAL] pg_dump problems

2011-03-23 Thread Martín Marqués
2011/3/23 Vick Khera vi...@khera.org: 2011/3/23 Martín Marqués martin.marq...@gmail.com: The second error is very curious, as it looks like pg_dump changed 1 for a 'q' in an integer field: psql:siprebi-bu.sql:2219245: ERROR:  la sintaxis de entrada no es válida para integer: «q721695»

[GENERAL] pdf saving into DB vs. saving file location ?

2011-03-23 Thread Emi Lu
Hello list, A question about saving PDF (size around 160kb) into postgresql large object columns vs. saving into a directory. May I know the performance differences? Pros and crons please? Each year, 20 new pdfs will be saved into DB (each around 160KB). Thanks a lot! Emi -- Sent via

Re: [GENERAL] pdf saving into DB vs. saving file location ?

2011-03-23 Thread Bill Moran
In response to Emi Lu em...@encs.concordia.ca: Hello list, A question about saving PDF (size around 160kb) into postgresql large object columns vs. saving into a directory. May I know the performance differences? Pros and crons please? Each year, 20 new pdfs will be saved into DB

Re: [GENERAL] pdf saving into DB vs. saving file location ?

2011-03-23 Thread Devrim GÜNDÜZ
On Wed, 2011-03-23 at 16:01 -0400, Emi Lu wrote: A question about saving PDF (size around 160kb) into postgresql large object columns vs. saving into a directory. May I know the performance differences? Pros and crons please? Each year, 20 new pdfs will be saved into DB (each around

Re: [GENERAL] pdf saving into DB vs. saving file location ?

2011-03-23 Thread Andrew Sullivan
On Wed, Mar 23, 2011 at 04:05:44PM -0400, Bill Moran wrote: We store a WHOLE lot more binary data in our DBs than that. The big advantage to us is that we store the data in TEXT fields, and use Slony to replicate it, so in the event of hardware failure, we don't have to worry about the DB

Re: [GENERAL] Understanding Datum

2011-03-23 Thread Nick Raj
Hi, In postgres, typedef uintptr_t Datum Datum is getting value from PG_GETARG_POINTER(1); But, now problem is how would i know the type of PG_GETARG_POINTER(1) (postgres internally pass this argument) to figure out datum type? Can you tell detailed structure of Datum, so i can print the value??

Re: [GENERAL] pdf saving into DB vs. saving file location ?

2011-03-23 Thread Vick Khera
On Wed, Mar 23, 2011 at 4:01 PM, Emi Lu em...@encs.concordia.ca wrote: A question about saving PDF (size around 160kb) into postgresql large object columns vs. saving into a directory. May I know the performance differences? Pros and crons please? Each year, 20 new pdfs will be saved into DB

Re: [GENERAL] Understanding Datum

2011-03-23 Thread Tom Lane
Nick Raj nickrajj...@gmail.com writes: In postgres, typedef uintptr_t Datum Datum is getting value from PG_GETARG_POINTER(1); But, now problem is how would i know the type of PG_GETARG_POINTER(1) (postgres internally pass this argument) to figure out datum type? Datum does not carry any type

[GENERAL] PG Session #2 : Call For Papers

2011-03-23 Thread damien clochard
Hi, The first PostgreSQL Session organized by Dalibo last february was a big success. More than 80 public and private participants gathered in Paris. Dalibo and Oslandia want to carry on this success and set up a new conference day dedicated to PostGIS, on June 23d in Paris.

Re: [GENERAL] Recursive function that receives a list of IDs and returns all child IDs

2011-03-23 Thread Merlin Moncure
On Wed, Mar 23, 2011 at 10:29 AM, Sven Haag sven-h...@gmx.de wrote: hello pgsql fans out there, i've already created a function that returns a list of IDs of all sub-samples based on a given sample ID. this works fine. now i like to extend this function so that it can receive a list of

Re: [GENERAL] constraint partition issue

2011-03-23 Thread Tom Lane
hyelluas helen_yell...@mcafee.com writes: sorry, my table has many columns and missed the datex when make it look smaller. datex is the column in the table. This is the driving constraint. My task is to have 30 days of data with 5mln to 10 mln rec in 1 hour table, so I partition it by hour

Re: [GENERAL] Linux, Hungarian charset (Win1250) is supports the hungarian collation?

2011-03-23 Thread Peter Eisentraut
On mån, 2011-03-21 at 11:22 +0100, Durumdara wrote: The language is Windows 1250 (ISO-8859-2). I remembered that when I tried in 8.1 to create database as same in Windows: CharSet: Win1250 Collation: - (disabled, and it is handled as HUN - iso-8859-2) then I failed. Because in Linux

[GENERAL] DO Statement Body Parameters

2011-03-23 Thread David Johnston
I think I understand what is happening but am curious if something along these lines can be accomplished? Consider the following SQL statement (executed via JDBC against a 9.0.3 installation): DO $$ BEGIN PERFORM someexistingfunction ( ? ); END; $$ It appears that such a format is invalid since

Re: [GENERAL] constraint partition issue

2011-03-23 Thread hyelluas
You are right to the point, Tom. The datex is timestamp with time zone and the constraints were created as timestamp without time zone. As soon as I fixed that , it all started working. thank you! Helen -- View this message in context:

Re: [GENERAL] Utilities for managing streaming replication servers?

2011-03-23 Thread Toby Corkindale
On 23/03/11 20:18, John R Pierce wrote: On 03/22/11 11:18 PM, Toby Corkindale wrote: Hi, I wondered if there were any software packages floating around to manage servers using streaming replication with Pg? ie. To handle failing over and adjusting the config to promote a slave; and performing

Re: [GENERAL] Recursive function that receives a list of IDs and returns all child IDs

2011-03-23 Thread Jens Kapp
i guess an array is also ok. must been something like: fn_get_subsamples(IN sample_numbers[] integer) ?? how would a query then look like? SELECT * FROM sample WHERE sample_number IN ( fn_get_subsamples(1,2,3,4) ) ?? cheers sven Am 23.03.2011 17:42, schrieb Tom Lane: Sven

Re: [GENERAL] Understanding Datum

2011-03-23 Thread Radosław Smogura
Nick Raj nickrajj...@gmail.com Wednesday 23 March 2011 18:45:41 Hi, I am understanding the postgres code. In code, i just want to see what are values that are passing through the variables? Can you please tell me if the variable is of type Datum, then how to print its value? Because i dont

[GENERAL] What does error psql: Kerberos 5 authentication not supported means?

2011-03-23 Thread Yandong.Yao
Hi Guys, I tried to setup kerberos authentication with postgresql 8.4.7 on Ubuntu 10.10. When I use: $ psql –h ubuntu.server –U gavin dbname I get following error: psql: Kerberos 5 authentication not supported. And from the server side of postgresql, I could see following log: 2011-03-23

Re: [GENERAL] Weird problems with C extension and bytea as input type

2011-03-23 Thread Adrian Schreyer
On Wed, Mar 23, 2011 at 14:08, Merlin Moncure mmonc...@gmail.com wrote: On Wed, Mar 23, 2011 at 9:04 AM, dennis jenkins dennis.jenkins...@gmail.com wrote: On Wed, Mar 23, 2011 at 5:08 AM, Adrian Schreyer ams...@cam.ac.uk wrote: you are right, it returns a char *. The prototype: char

Re: [GENERAL] Understanding Datum

2011-03-23 Thread Nick Raj
If Datum contains only the value (not having type specific info.), then Suppose i want to print the Datum V value (already defined in postgres) then printf(%??, V); Because V is assigned by PG_GETARG_POINTER(1); I don't having the information of type Datum. How to print the value of Datum in