Re: [GENERAL] Optimise PostgreSQL for fast testing

2012-02-24 Thread Alban Hertroys
On 24 Feb 2012, at 1:00, Dmytrii Nagirniak wrote: What are the specs? A typical DB spec (test) does the following: 1. Creates a number of records (commonly about 5-ish, but may vary from 1 to ~40 across all tables). 2. Executes some queries against the dataset (**MOST** of them are pretty

Re: [GENERAL] Problemas com client_encoding ?

2012-02-24 Thread Richard Huxton
On 24/02/12 02:34, Emanuel Araújo wrote: [user@local ~]$ psql psql: invalid connection option client_encoding 1o. Server SO - Centos 5.7 Final PostgreSQL 9.1.1 Apologies - my Spanish is non-existent (that's assuming your email wasn't in Portugese or some such).

Re: [GENERAL] COPY TO File: Using dynamic file name in stored procedure

2012-02-24 Thread Albe Laurenz
Carlos Oliva wrote: What would it be the correct format for using a variable in a stored procedure that uses COPY TO? I have the current stored procedure: CREATE FUNCTION Table_To_File(text) RETURNS void AS $delimeter$ COPY (SELECT * FROM table_to_xml('table', true, false, '')) TO '$1'

Re: [GENERAL] Optimise PostgreSQL for fast testing

2012-02-24 Thread Simon Riggs
On Fri, Feb 24, 2012 at 12:16 AM, Dmytrii Nagirniak dna...@gmail.com wrote: That's totally fine if PG can't beat SQLite on speed in **this particular case**. The point is that PG can beat SQLite in this test *easily* if you choose to use the main architectural difference as an advantage:

[GENERAL] invalid memory alloc request size 1765277700 Error Question

2012-02-24 Thread Naoko Reeves
Version: PostgreSQL 8.4.6 on i386-apple-darwin, compiled by GCC i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5370), 32-bit There was an hardware crash. after that pg_dump failed with an error: ERROR: invalid memory alloc request size 1765277700 I searched archive and it

[GENERAL] Regular expression character escape

2012-02-24 Thread Ronan Dunklau
Hello. I'd like to perform a query using user-submitted input in a regular expression. Something along the lines of: select some_col from some_table where some_col ~ ('^' || user_submitted_input || '\d*$') This query is looking for every value matching the user submitted input with optional

[GENERAL] Configuring for very slow I/O

2012-02-24 Thread A B
Hi there. I'm stuck with a machine with so very slow I/O one starts to remember the good-old-days when we had 3,5 floppies. So I can't do anything with the hardware, but what settings in the config should I use to make handle the extremly slow I/O? Any suggestions? -- Sent via pgsql-general

[GENERAL] problem trying to create a temp table

2012-02-24 Thread mgould
text/html; charset="utf-8": Unrecognized inline: top.letterhead

Re: [GENERAL] problem trying to create a temp table

2012-02-24 Thread Richard Huxton
On 24/02/12 13:26, mgo...@isstrucksoftware.net wrote: ALL, Using 9.1.2 on Windows 7 X64 for development. I'm trying to create a temporary table used to store session variables CREATE TEMP TABLE iss.sessionsettings When I try and run this I get the following error message. ERROR: cannot

Re: [GENERAL] problem trying to create a temp table

2012-02-24 Thread mgould
text/html; charset="utf-8": Unrecognized inline: top.letterhead

Re: [GENERAL] problem trying to create a temp table

2012-02-24 Thread Andrew Gould
On Fri, Feb 24, 2012 at 7:32 AM, Richard Huxton d...@archonet.com wrote: On 24/02/12 13:26, mgo...@isstrucksoftware.net wrote: ALL, Using 9.1.2 on Windows 7 X64 for development. I'm trying to create a temporary table used to store session variables  CREATE TEMP TABLE iss.sessionsettings

Re: [GENERAL] problem trying to create a temp table

2012-02-24 Thread Andrew Gould
On Fri, Feb 24, 2012 at 7:36 AM, mgo...@isstrucksoftware.net wrote: How do I access it. I just did that and when I try and access it with a ERROR: relation sessionsetting does not exist LINE 1: select * from sessionsetting ^ ** Error ** ERROR:

Re: [GENERAL] problem trying to create a temp table

2012-02-24 Thread mgould
Andrew, That is acutally what the second run was supposed to be. I copied the original on instead of the second instance, but the results were the same. Michael Gould Intermodal Software Solutions, LLC 904-226-0978 Original Message Subject: Re: [GENERAL] problem trying

Re: [GENERAL] problem trying to create a temp table

2012-02-24 Thread Richard Huxton
On 24/02/12 13:36, mgo...@isstrucksoftware.net wrote: How do I access it. I just did that and when I try and access it with a ERROR: relation sessionsetting does not exist LINE 1: select * from sessionsetting = CREATE SCHEMA foo; CREATE SCHEMA = CREATE TABLE foo.table1 (id int); CREATE TABLE =

Re: [GENERAL] problem trying to create a temp table

2012-02-24 Thread Richard Huxton
On 24/02/12 13:37, Andrew Gould wrote: On Fri, Feb 24, 2012 at 7:32 AM, Richard Huxtond...@archonet.com wrote: Temp tables get their own schema, and each session (connection) gets its own temp schema. So - don't qualify them by schema. Is that to avoid naming conflicts between simultaneous

Re: [GENERAL] Configuring for very slow I/O

2012-02-24 Thread Vick Khera
On Fri, Feb 24, 2012 at 7:39 AM, A B gentosa...@gmail.com wrote: So I can't do anything with the hardware, but what settings in the config should I use to make handle the extremly slow I/O? Try adjusting your random and sequential page cost tunables. Other than that, see if you can add lots of

Re: [GENERAL] Measuring replication lag time

2012-02-24 Thread Samba
Comparing pg_controldata output on prod and standby might help you with this. We do use this approach and it is pretty reliable and gives time lag up to the granularity of checkpoint_timeout. On Thu, Feb 23, 2012 at 11:51 AM, Stuart Bishop stu...@stuartbishop.netwrote: On Thu, Feb 23,

[GENERAL] Having a problem with RoR-3.1.1 and Pg-0.1

2012-02-24 Thread James B. Byrne
CentOS-5.7 RoR-3.1.1 Pg-9.1 I am trying to run a test suite against Pg-9.1 for a RoR-3.1.1 based application. When I run the test DB setup task it fails: $ rake db:test:prepare Using AdapterExtensions psql:/...rails3/db/development_structure.sql:22: ERROR: must be owner of extension plpgsql

Re: [GENERAL] problem trying to create a temp table

2012-02-24 Thread Adrian Klaver
On Friday, February 24, 2012 5:46:06 am mgo...@isstrucksoftware.net wrote: Andrew, That is acutally what the second run was supposed to be. I copied the original on instead of the second instance, but the results were the same. Are you doing all this in the same session?:

Re: [GENERAL] Having a problem with RoR-3.1.1 and Pg-0.1

2012-02-24 Thread Adrian Klaver
On Friday, February 24, 2012 7:16:47 am James B. Byrne wrote: CentOS-5.7 RoR-3.1.1 Pg-9.1 I am trying to run a test suite against Pg-9.1 for a RoR-3.1.1 based application. When I run the test DB setup task it fails: $ rake db:test:prepare Using AdapterExtensions

Re: [GENERAL] Regular expression character escape

2012-02-24 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Ronan Dunklau Sent: Friday, February 24, 2012 6:34 AM To: pgsql-general@postgresql.org Subject: [GENERAL] Regular expression character escape Hello. I'd like to perform a

[GENERAL] Stability in Windows?

2012-02-24 Thread Durumdara
Hi! We planned to port some very old DBASE db into PGSQL. But somebody said in a developer list that he tried with PGSQL (8.x) and it was very unstable in Windows (and it have problem when many users use it). Another people also said that they used PGSQL only in Linux - and there is no problem

Re: [GENERAL] Stability in Windows?

2012-02-24 Thread mgould
We are using it on a rather beefy server with no problems with a Win32 client/server app. There are additonal things you can do to tune the database. I've not seen any stability problems. Remember it's been several years since version 8 came out and the current version is 9.1.2. Michael Gould

Re: [GENERAL] Stability in Windows?

2012-02-24 Thread Serge Fonville
Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Google!! They need to add GAL support on Android (star to agree) http://code.google.com/p/android/issues/detail?id=4602 2012/2/24 mgo...@isstrucksoftware.net We are using it on a rather beefy server

Re: [GENERAL] Stability in Windows?

2012-02-24 Thread Durumdara
Hi! 2012/2/24 mgo...@isstrucksoftware.net We are using it on a rather beefy server with no problems with a Win32 client/server app. Which programming language you use in clients? Which adapter? If Delphi then which components? There are additonal things you can do to tune the database.

Re: [GENERAL] Regular expression character escape

2012-02-24 Thread Ronan Dunklau
On 24/02/2012 16:38, David Johnston wrote: How about: WHERE some_col LIKE (user_submitted_input || '%') AND some_col ~ ('^.{' || length_of_user_submitted_input || '}\d*$') I'd have some reservations regarding multi-byte characters however - but this avoids any escaping of the input

Re: [GENERAL] Stability in Windows?

2012-02-24 Thread Adrian Klaver
On Friday, February 24, 2012 7:39:39 am Durumdara wrote: Hi! We planned to port some very old DBASE db into PGSQL. But somebody said in a developer list that he tried with PGSQL (8.x) and it was very unstable in Windows (and it have problem when many users use it). The first native

Re: [GENERAL] Stability in Windows?

2012-02-24 Thread Scott Marlowe
On Fri, Feb 24, 2012 at 8:53 AM, mgo...@isstrucksoftware.net wrote: We are using it on a rather beefy server with no problems with a Win32 client/server app.  There are additonal things you can do to tune the database.  I've not seen any stability problems.  Remember it's been several years

Re: [GENERAL] Stability in Windows?

2012-02-24 Thread Serge Fonville
Doesn't http://wiki.postgresql.org/wiki/Running_%26_Installing_PostgreSQL_On_Native_Windows#I_cannot_run_with_more_than_about_125_connections_at_once.2C_despite_having_capable_hardware apply? Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Google!! They

Re: [GENERAL] Regular expression character escape

2012-02-24 Thread Heiko Wundram
Am 24.02.2012 17:04, schrieb Ronan Dunklau: On 24/02/2012 16:38, David Johnston wrote: You could (should?) write the escaping routine on the server side in a user-defined function: WHERE some_col ~ ('^' || make_regexp_literal(user_submitted_stringliteral) || '\d*$') I totally agree, but I

Re: [GENERAL] Stability in Windows?

2012-02-24 Thread Magnus Hagander
On Fri, Feb 24, 2012 at 17:05, Scott Marlowe scott.marl...@gmail.com wrote: On Fri, Feb 24, 2012 at 8:53 AM,  mgo...@isstrucksoftware.net wrote: We are using it on a rather beefy server with no problems with a Win32 client/server app.  There are additonal things you can do to tune the

Re: [GENERAL] Regular expression character escape

2012-02-24 Thread Ronan Dunklau
On 24/02/2012 17:09, Heiko Wundram wrote: Am 24.02.2012 17:04, schrieb Ronan Dunklau: On 24/02/2012 16:38, David Johnston wrote: You could (should?) write the escaping routine on the server side in a user-defined function: WHERE some_col ~ ('^' ||

Re: [GENERAL] Regular expression character escape

2012-02-24 Thread Heiko Wundram
Am 24.02.2012 17:40, schrieb Ronan Dunklau: On 24/02/2012 17:09, Heiko Wundram wrote: Use the corresponding function of your programming language/framework of choice. E.g. Python delivers this as re.escape(). Thank you, but as I wrote in the original post, I don't know how postgresql and

Re: [GENERAL] Regular expression character escape

2012-02-24 Thread Ronan Dunklau
On 24/02/2012 17:43, Heiko Wundram wrote: Am 24.02.2012 17:40, schrieb Ronan Dunklau: On 24/02/2012 17:09, Heiko Wundram wrote: Use the corresponding function of your programming language/framework of choice. E.g. Python delivers this as re.escape(). Thank you, but as I wrote in the original

Re: [GENERAL] invalid memory alloc request size 1765277700 Error Question

2012-02-24 Thread Garrett Murphy
Curious: was there some sort of hardware issue or anything like that preceding this issue? Version: PostgreSQL 8.4.6 on i386-apple-darwin, compiled by GCC i686-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5370), 32-bit There was an hardware crash. after that pg_dump

Re: [GENERAL] invalid memory alloc request size 1765277700 Error Question

2012-02-24 Thread Tom Lane
Naoko Reeves naokoree...@gmail.com writes: [ inconsistent behavior with a corrupted table ] I think most likely some of these queries are using a corrupted index and some are not --- have you looked at the EXPLAIN for each one? It might be a good idea to turn off enable_indexscan and

Re: [GENERAL] Regular expression character escape

2012-02-24 Thread Tom Lane
Ronan Dunklau rdunk...@gmail.com writes: Unfortunately for my use case, too much quoting can lead to errors in postgresql. AFAIR, the only stuff that's unsafe to insert a backslash before is ASCII letters. This is documented in the fine print discussing regular expressions, btw.

Re: [GENERAL] Upgrade to 9.1 causing function problem

2012-02-24 Thread Willem Buitendyk
I did create the schemas with PgAdmin. As a test I also created another schema in psql and it too has the same problems with the function not working. I also created the function this time without relying on search_path and even altered the function and tables names slightly just in case

Re: [GENERAL] invalid memory alloc request size 1765277700 Error Question

2012-02-24 Thread Scott Marlowe
On Fri, Feb 24, 2012 at 10:09 AM, Tom Lane t...@sss.pgh.pa.us wrote: Naoko Reeves naokoree...@gmail.com writes: [ inconsistent behavior with a corrupted table ] I think most likely some of these queries are using a corrupted index and some are not --- have you looked at the EXPLAIN for each

Re: [GENERAL] Upgrade to 9.1 causing function problem

2012-02-24 Thread Willem Buitendyk
Ok I must be doing something wrong. I tried the same test on my old server running 8.3 which has had no problem with anything up till now (but also only working within public schema). So I am obviously not working with schemas correctly. Will read the manual for hopefully a deeper

Re: [GENERAL] invalid memory alloc request size 1765277700 Error Question

2012-02-24 Thread Tom Lane
Scott Marlowe scott.marl...@gmail.com writes: On Fri, Feb 24, 2012 at 10:09 AM, Tom Lane t...@sss.pgh.pa.us wrote: Naoko Reeves naokoree...@gmail.com writes: [ inconsistent behavior with a corrupted table ] I think most likely some of these queries are using a corrupted index and some are

[GENERAL] Maxium Share Memory in Debian 64bit

2012-02-24 Thread Prashant Bharucha
Hello All Could you please help to figure out how much maxium memory can allocated in Shared Memory on Debian 64 bit OS ? Thx Prashant

Re: [GENERAL] Upgrade to 9.1 causing function problem

2012-02-24 Thread Willem Buitendyk
I tried as you suggested and my results are: crabby=# SELECT length(schema_name), schema_name from information_schema.schemat a; length |schema_name + 8 | pg_toast 9 | pg_temp_1 15 | pg_toast_temp_1 10 | pg_catalog 6 | public 18 |

Re: [GENERAL] Maxium Share Memory in Debian 64bit

2012-02-24 Thread John R Pierce
On 02/24/12 11:41 AM, Prashant Bharucha wrote: Hello All Could you please help to figure out how much maxium memory can allocated in Shared Memory on Debian 64 bit OS ? I rarely set shared_buffers over about 2GB even on machines with 48GB or more ram. its a case of diminishing returns,

Re: [GENERAL] Stability in Windows?

2012-02-24 Thread Igor Neyman
125_connections - this is a problem related to older PG versions (and in my own experience, the number is closer to 230, not 125), and I believe it was fixed in newer versions. Besides, it's much more efficient to use connection pulling (PgBouncer, PgPool), when dealing with that many

[GENERAL] explain and index scan

2012-02-24 Thread psql
Hi all. PostgreSQL 9.1.2 on i686-pc-linux-gnu, compiled by gcc-4.4.real (Debian 4.4.5-8) 4.4.5, 32-bit id | integer | not null Vorgabewert nextval('a_id_seq'::regclass) a | integer | not null b | integer | not null Indexe: a_pkey PRIMARY KEY, btree (id) a_a_key UNIQUE CONSTRAINT,

[GENERAL] Re: When I try to connect to a database, I get the following error : psql teleflowdb8

2012-02-24 Thread seha
When I try to connect to a database, I get the following error : psql teleflowdb8 psql: FATAL: database is not accepting commands to avoid wraparound data loss in database teleflowdb8 HINT: Stop the postmaster and use a standalone backend to vacuum database teleflowdb8. Then I try to go to

Re: [GENERAL] invalid memory alloc request size 1765277700 Error Question

2012-02-24 Thread Scott Marlowe
On Fri, Feb 24, 2012 at 4:01 AM, Naoko Reeves naokoree...@gmail.com wrote: -- I have narrowed down the row SELECT * FROM table ORDER BY table_id OFFSET 526199 LIMIT 1  -- ERROR: invalid memory alloc request size 1765277700 Are you certain that offset 526199 is using both the same query plan

Re: [GENERAL] Re: When I try to connect to a database, I get the following error : psql teleflowdb8

2012-02-24 Thread Scott Marlowe
On Fri, Feb 24, 2012 at 2:30 AM, seha blackroos...@yahoo.com wrote: When I try to connect to a database, I get the following error : psql teleflowdb8 psql: FATAL:  database is not accepting commands to avoid wraparound data loss in database teleflowdb8 HINT:  Stop the postmaster and use a

Re: [GENERAL] Stability in Windows?

2012-02-24 Thread Scott Marlowe
On Fri, Feb 24, 2012 at 12:58 PM, Igor Neyman iney...@perceptron.com wrote: “125_connections” – this is a problem related to “older” PG versions (and in my own experience, the number is closer to 230, not 125), and I believe it was fixed in newer versions. Besides, it’s much more efficient to

Re: [GENERAL] Maxium Share Memory in Debian 64bit

2012-02-24 Thread Scott Marlowe
On Fri, Feb 24, 2012 at 12:41 PM, Prashant Bharucha prashantbharu...@yahoo.ca wrote: Hello All Could you please help to figure out how much maxium memory can allocated in Shared Memory on Debian 64 bit OS ? With appropriate shm settings, you can easily set it high enough to cause problems

Re: [GENERAL] Re: When I try to connect to a database, I get the following error : psql teleflowdb8

2012-02-24 Thread Adrian Klaver
On Friday, February 24, 2012 12:31:34 pm Scott Marlowe wrote: On Fri, Feb 24, 2012 at 2:30 AM, seha blackroos...@yahoo.com wrote: When I try to connect to a database, I get the following error : That's the wrong direction. Try just copying /etc/postgres/8.2/main/postgresql.conf to

Re: [GENERAL] Upgrade to 9.1 causing function problem

2012-02-24 Thread Adrian Klaver
On Friday, February 24, 2012 10:31:44 am Willem Buitendyk wrote: Ok I must be doing something wrong. I tried the same test on my old server running 8.3 which has had no problem with anything up till now (but also only working within public schema). So I am obviously not working with schemas

[GENERAL] Disk file effects of delete and vacuum

2012-02-24 Thread Clodoaldo Neto
I have a very frequently updated table with 240 million rows (and growing). Every three hours 1.5 million rows are inserted and 1.5 million are deleted. When I moved the cluster to a SSD this bulk insert (using copy) time was cut from 22 minutes to 2.3 minutes. The deletion time was also improved.

[GENERAL] Re: [PERFORM] Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

2012-02-24 Thread Jayashankar K B
Hi Tom, I tried to apply the patch. I succeeded in patching configure, configure.in and src/include/pg_config.h.in files. But while applying the patch for src/include/storage/s_lock.h , I am getting an error. This is how I am doing the patch, 1. I copied the diff output given in the link

[GENERAL] Pull the Trigger and Where's the SQL?

2012-02-24 Thread Ched Cheatham
I have a trigger on a table which fires ON update...the solution I am working requires that I get the actual SQL statement (the text) that has been executed by postgreSQL that caused the trigger to fire. Currently the trigger solution is pljava because I am eventually planning on throwing the

[GENERAL] Behavior of subselects in target lists and order by

2012-02-24 Thread amit sehas
If we have a query of the form: Select *, (Select * FROM T2 WHERE p2 = T1.p1) FROM T1 ORDER BY 1 WHERE p3 = 75 In the above query there is a subselect in the target list and the ORDERBY has an ordinal number which indicates order by column 1. Does this mean that the above query will return all

Re: [GENERAL] Re: [PERFORM] Disable-spinlocks while compiling postgres 9.1 for ARM Cortex A8

2012-02-24 Thread Tom Lane
Jayashankar K B jayashankar...@lnties.com writes: I tried to apply the patch. I succeeded in patching configure, configure.in and src/include/pg_config.h.in files. But while applying the patch for src/include/storage/s_lock.h , I am getting an error. That patch should apply exactly to 9.1.0

Re: [GENERAL] Behavior of subselects in target lists and order by

2012-02-24 Thread John R Pierce
On 02/24/12 12:45 PM, amit sehas wrote: If we have a query of the form: Select *, (Select * FROM T2 WHERE p2 = T1.p1) FROM T1 ORDER BY 1 WHERE p3 = 75 ORDER BY has to be AFTER the WHERE clause. is that query equivalent to... Select t1.*, t2.* FROM T1 LEFT JOIN T2 on T1.p1=t2.p2 WHERE t1.p3

Re: [GENERAL] Pull the Trigger and Where's the SQL?

2012-02-24 Thread John R Pierce
On 02/24/12 2:05 PM, Ched Cheatham wrote: I have a trigger on a table which fires ON update...the solution I am working requires that I get the actual SQL statement (the text) that has been executed by postgreSQL that caused the trigger to fire. Currently the trigger solution is pljava

Re: [GENERAL] invalid memory alloc request size 1765277700 Error Question

2012-02-24 Thread Naoko Reeves
Tom, Scott, Thank you very much for your advice and right questions that lead to me the solution - In summary, I was able to identify and delete all corrupted data with no data loss. Everything add up once I disabled index per Tom's advice. Here is the detail report: Review the data again in