[GENERAL] Re: passing schema name and table name as parameter functions in postgresql 9.2

2013-06-06 Thread anushasrivastava03
hi my requirement is to create a table as a result of sub-query and the table and schema name should be passed as parameters of a function i also tried like this; CREATE OR REPLACE FUNCTION secc_master.chkschema(schemaname text, tableis text) RETURNS void AS $BODY$ DECLARE ione boolean;

[GENERAL] compiling postgresql 9.2.4 on fedora 17 64 bit takes very long time

2013-06-06 Thread c k
Hi, Yesterday we configured a new server with Fedora 17 64 bit and updated it's kernel to 3.8. I have to compile and install postgresql with python. So I executed commands ./configure --with-python make but make is running for last 16 hours and still not completed. It is showing same messages aga

Re: [GENERAL] PSA: If you are running Precise/12.04 upgrade your kernel.

2013-06-06 Thread Nikhil G Daddikar
Folks, This is bad news as I run Ubuntu 12.04 LTS. However, my ubuntu 12.04 LTS boxes have been updated to "3.5.0-32-generic" (official update). Any idea whether the Postgresql has problems with this kernel? I'd like to follow the "official" LTS updates because I am not sure what other surpri

[GENERAL] Re: checking schema present or not by passing schema name as parameter

2013-06-06 Thread anushasrivastava03
thanks 'quote_literal' worked :) -- View this message in context: http://postgresql.1045698.n5.nabble.com/checking-schema-present-or-not-by-passing-schema-name-as-parameter-tp5758131p5758251.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-genera

Re: [GENERAL] PSA: If you are running Precise/12.04 upgrade your kernel.

2013-06-06 Thread Toby Corkindale
On 07/06/13 08:35, Joshua D. Drake wrote: Hello, I had the distinct displeasure of staying up entirely too late with a customer this week because they upgraded to 12.04 and immediately experienced a huge performance regression. In the process they also upgraded to PostgreSQL 9.1 from 8.4. There

Re: [GENERAL] Trouble with replication

2013-06-06 Thread Michael Paquier
On Thu, Jun 6, 2013 at 9:19 PM, David Greco wrote: > Then what is the purpose to shipping the archived WAL files to the > slave? i.e. if wal_keep_segments has to be high enough to cover any > replication lag anyways, then should I even bother shipping them over? > Oh. I just noticed that you set

Re: [GENERAL] PSA: If you are running Precise/12.04 upgrade your kernel.

2013-06-06 Thread Joshua D. Drake
On 06/06/2013 03:48 PM, Scott Marlowe wrote: On Thu, Jun 6, 2013 at 4:35 PM, Joshua D. Drake wrote: Hello, I had the distinct displeasure of staying up entirely too late with a customer this week because they upgraded to 12.04 and immediately experienced a huge performance regression. In th

Re: [GENERAL] PSA: If you are running Precise/12.04 upgrade your kernel.

2013-06-06 Thread Scott Marlowe
On Thu, Jun 6, 2013 at 4:35 PM, Joshua D. Drake wrote: > > Hello, > > I had the distinct displeasure of staying up entirely too late with a > customer this week because they upgraded to 12.04 and immediately > experienced a huge performance regression. In the process they also upgraded > to Postgr

Re: [GENERAL] Slave promotion failure

2013-06-06 Thread Michael Paquier
On Fri, Jun 7, 2013 at 1:37 AM, François Beausoleil wrote: > I can't seem to promote the slave: > > $ sudo -u postgres touch /var/lib/postgresql/9.1/main/recovery.done > # log is silent > This has no effect. recovery.conf is renamed to recovery.done internally by the server. If recovery.done is pr

[GENERAL] PSA: If you are running Precise/12.04 upgrade your kernel.

2013-06-06 Thread Joshua D. Drake
Hello, I had the distinct displeasure of staying up entirely too late with a customer this week because they upgraded to 12.04 and immediately experienced a huge performance regression. In the process they also upgraded to PostgreSQL 9.1 from 8.4. There were a lot of knobs to change/fix/modi

Re: [GENERAL] Database performs massive reads when I'm doing writes.

2013-06-06 Thread Ray Cote
- Original Message - > From: "Jeff Janes" > To: "Ray Cote" > Cc: pgsql-general@postgresql.org > Sent: Thursday, June 6, 2013 5:41:00 PM > Subject: Re: [GENERAL] Database performs massive reads when I'm doing > writes. > On Thu, Jun 6, 2013 at 2:12 PM, Ray Cote < > rgac...@appropriatesol

Re: [GENERAL] Load Mysql table CSV into postgresql

2013-06-06 Thread Thomas Kellerer
Adarsh Sharma wrote on 06.06.2013 19:33: Hi, Today i need to load some mysql ( 5.1.58 ) tables dump in postgresql ( PG 9.2 ). I loaded few tables successfully but while loading one table i am facing below error : After some research , i think it is failing because Mysql table has character set

Re: [GENERAL] User postgres unable to revoke privileges?

2013-06-06 Thread Tom Lane
=?iso-8859-1?Q?Fran=E7ois_Beausoleil?= writes: > regress=# ALTER DEFAULT PRIVILEGES FOR ROLE dataanalysts IN SCHEMA public > REVOKE SELECT ON TABLES FROM dataanalysts; > ERROR: permission denied for schema public > I'm logged in as postgres, the database superuser. Why am I getting a > permiss

Re: [GENERAL] Load Mysql table CSV into postgresql

2013-06-06 Thread Adrian Klaver
On 06/06/2013 12:58 PM, Adarsh Sharma wrote: Thanks Adrian , i think it works but still facing problem while loading Mysql ( MEDIUMBLOB ) column into PG ( BYTEA ) column : test=# \encoding LATIN1; test=# copy jobs from '/tmp/test.csv' with DELIMITER AS ',' QUOTE '"' NULL AS '\N' ESCAPE E'\\' C

Re: [GENERAL] Database performs massive reads when I'm doing writes.

2013-06-06 Thread Jeff Janes
On Thu, Jun 6, 2013 at 2:12 PM, Ray Cote wrote: > It is Postmaster itself: > 11068 - 315.9M > 136K 0K 85% postmaster > 11000 - 56808K > 8K 0K 15% postmast

Re: [GENERAL] Database performs massive reads when I'm doing writes.

2013-06-06 Thread Ray Cote
And... it was a rookie mistake. In answering the last question I once again looked at the database and realized there was an index missing! Swear it has been there before (and I should have double-checked sooner). Added the index and now we're moving right along. Thanks for all leads everyone

Re: [GENERAL] Database performs massive reads when I'm doing writes.

2013-06-06 Thread Ray Cote
It is Postmaster itself: 11068 - 315.9M 136K 0K 85% postmaster 11000 - 56808K 8K 0K 15% postmaster 11003 - 0K 80K 0K 0% postmaster 11004 - 0K 24K 0K 0% postmaster 11067 - 0K 0K 0K 0% load_rets.py The above are the atop lines for just postmaster. This is a 10s snapshot so you can see lots of

Re: [GENERAL] Function use in query

2013-06-06 Thread David Johnston
Ioana Danes wrote > create view tmp_view as > with func as ( >     select tmp_Cashdrawer.CashdrawerID, test1(tmp_Cashdrawer.CashdrawerID) > as call >     from tmp_Cashdrawer > ) > select func.CashdrawerID, (func.call).* > from func; So yeah, putting this into a view will not work. The WITH/CTE c

Re: [GENERAL] Database performs massive reads when I'm doing writes.

2013-06-06 Thread Jeff Janes
On Thu, Jun 6, 2013 at 9:53 AM, Ray Cote wrote: > Hello: > > I have a PostgreSQL 9.0.3 database that has suddenly started exhibiting > odd read behavior. > > The version number is: > "PostgreSQL 9.0.3 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) > 4.1.2 20080704 (Red Hat 4.1.2-50), 64-bi

Re: [GENERAL] Load Mysql table CSV into postgresql

2013-06-06 Thread Adarsh Sharma
Thanks Adrian , i think it works but still facing problem while loading Mysql ( MEDIUMBLOB ) column into PG ( BYTEA ) column : test=# \encoding LATIN1; test=# copy jobs from '/tmp/test.csv' with DELIMITER AS ',' QUOTE '"' NULL AS '\N' ESCAPE E'\\' CSV; ERROR: invalid input syntax for type bytea

Re: [GENERAL] Database performs massive reads when I'm doing writes.

2013-06-06 Thread Ray Cote
- Original Message - > From: "bricklen" > To: "Ray Cote" > Cc: pgsql-general@postgresql.org > Sent: Thursday, June 6, 2013 3:44:04 PM > Subject: Re: [GENERAL] Database performs massive reads when I'm doing > writes. > On Thu, Jun 6, 2013 at 9:53 AM, Ray Cote < > rgac...@appropriatesolut

Re: [GENERAL] Database performs massive reads when I'm doing writes.

2013-06-06 Thread bricklen
On Thu, Jun 6, 2013 at 9:53 AM, Ray Cote wrote: > Starting a few days ago we started to see a strange behavior where writing > to the database causes massive read operations. > For example, I have a table that needs to be updated every night (about > 20,000 rows). > Using Django ORM, we update the

Re: [GENERAL] Function use in query

2013-06-06 Thread Ioana Danes
Ioana Danes wrote > > If I will have to filter the  tmp_Cashdrawer table then it executes the > function for the all the cash drawers and then filter out the result which > again is not efficient... Hm SELECT function_call(...) FROM tbl WHERE tbl.pk = ...; That should only cause function

Re: [GENERAL] Load Mysql table CSV into postgresql

2013-06-06 Thread Adrian Klaver
On 06/06/2013 10:33 AM, Adarsh Sharma wrote: Hi, Today i need to load some mysql ( 5.1.58 ) tables dump in postgresql ( PG 9.2 ). I loaded few tables successfully but while loading one table i am facing below error : test=# copy jobs from '/tmp/test.csv' with DELIMITER AS ',' QUOTE '"' NULL A

[GENERAL] Load Mysql table CSV into postgresql

2013-06-06 Thread Adarsh Sharma
Hi, Today i need to load some mysql ( 5.1.58 ) tables dump in postgresql ( PG 9.2 ). I loaded few tables successfully but while loading one table i am facing below error : test=# copy jobs from '/tmp/test.csv' with DELIMITER AS ',' QUOTE '"' NULL AS '\N' ESCAPE E'\\' CSV; ERROR: invalid byte s

[GENERAL] Database performs massive reads when I'm doing writes.

2013-06-06 Thread Ray Cote
Hello: I have a PostgreSQL 9.0.3 database that has suddenly started exhibiting odd read behavior. The version number is: "PostgreSQL 9.0.3 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-50), 64-bit" This was compiled from source about a year ago and has bee

Re: [GENERAL] Trouble with replication

2013-06-06 Thread Jeff Janes
On Wed, Jun 5, 2013 at 1:39 PM, David Greco wrote: > I’ve setup two 9.2.4 servers to serve as master-slave in a streaming > replication scenario. I started with a fresh database on the master, setup > the replication, then imported using pg_restore about 30GB of data. The > master and slave are

[GENERAL] plpgsql : looping over multidimensional array : getting NULL for subdimension

2013-06-06 Thread Vinicio Nocciolini
Use array_upper(aList, 2); see the example, maybe can help u CREATE OR REPLACE FUNCTION xxx( aList varchar[][]) returns TEXT as ' declare myUpper1 integer; myUpper2 integer; myRet varchar := ; begin myUpper1 := array_upper(aList, 1); IF myUpper1 IS NULL THEN

[GENERAL] Slave promotion failure

2013-06-06 Thread François Beausoleil
Hi, I have the following recovery.conf (Ubuntu 12.04): standby_mode = on restore_command = '/usr/local/omnipitr/bin/omnipitr-restore -D /var/lib/postgresql/9.1/main/ --source gzip=/var/backups/seevibes/wal/dbanalytics.production/ --remove-unneeded --temp-dir /var/tmp/omnipitr -l /var/log/omnip

Re: [GENERAL] Streaming replication with sync slave, but disconnects due to missing WAL segments

2013-06-06 Thread Jeff Janes
On Wed, Jun 5, 2013 at 11:26 PM, wrote: > Hi > > Thanks for your reply. Do you know of any options that I could give > pg_dump/psql to avoid creating one big transaction? I'm using the plain > text format for pg_dump. > For the plain text format, it is already not one big transaction, unless you

[GENERAL] User postgres unable to revoke privileges?

2013-06-06 Thread François Beausoleil
Hi all! I would like to remove the second line from default privileges, because dataanalysts can't create new tables in public anyway: # psql -U postgres psql (9.1.9) Type "help" for help. regress=# \ddp Default access privileges Owner |Schema| Type |

Re: [GENERAL] Function use in query

2013-06-06 Thread David Johnston
Ioana Danes wrote > > If I will have to filter the tmp_Cashdrawer table then it executes the > function for the all the cash drawers and then filter out the result which > again is not efficient... Hm SELECT function_call(...) FROM tbl WHERE tbl.pk = ...; That should only cause function_ca

Re: [GENERAL] Function use in query

2013-06-06 Thread Ioana Danes
Ioana Danes wrote > Hi All, > Is there any similar syntax that only invokes the procedure once and > returns all the columns? Generic, adapt to fit your needs. WITH func_call AS ( SELECT function_call(...) AS func_out_col ) SELECT (func_out_col).* FROM func_call; Basically you have to execut

Re: [GENERAL] Streaming replication with sync slave, but disconnects due to missing WAL segments

2013-06-06 Thread Shaun Thomas
On 06/04/2013 08:25 AM, mads.tand...@schneider-electric.com wrote: It all seems to work fine. But I have noticed that sometimes when I restore backups created by pg_dump. The slave node will disconnect with the message in the postgresql log: You need to increase wal_keep_segments on the master

Re: [GENERAL] PostgreSQL Synchronous Replication in production

2013-06-06 Thread Richard Huxton
On 06/06/13 12:48, Colin S wrote: Thanks for your answer. I find it very interesting that you say that synchronous setups should always be in two geographically separate locations. In this case they are on the same subnet. Adding the lag of committing to two, geographically separate, databases is

Re: [GENERAL] Trouble with replication

2013-06-06 Thread David Greco
From: Michael Paquier [mailto:michael.paqu...@gmail.com] Sent: Wednesday, June 05, 2013 9:43 PM To: David Greco Cc: John R Pierce; pgsql-general@postgresql.org Subject: Re: [GENERAL] Trouble with replication On Thu, Jun 6, 2013 at 7:23 AM, David Greco mailto:david_gr...@harte-hanks.com>> wrot

Re: [GENERAL] Trouble with replication

2013-06-06 Thread David Greco
From: Michael Paquier [mailto:michael.paqu...@gmail.com] Sent: Wednesday, June 05, 2013 9:43 PM To: David Greco Cc: John R Pierce; pgsql-general@postgresql.org Subject: Re: [GENERAL] Trouble with replication On Thu, Jun 6, 2013 at 7:23 AM, David Greco mailto:david_gr...@harte-hanks.com>> wrote:

Re: [GENERAL] PostgreSQL Synchronous Replication in production

2013-06-06 Thread Colin S
> Here's a few questions. How you answer them will decide whether you > really want synchronous replication or not: > 1. The link between servers encounters network congestion >a. The whole system should slow down. > Committed transactions should ALWAYS be on > two geographically

Re: [GENERAL] checking schema present or not by passing schema name as parameter

2013-06-06 Thread Pavel Stehule
Hello 2013/6/6 anushasrivastava03 : > i am checking if schema present or not and passing schema name dynamically > but it's trowing an error : > > > CREATE OR REPLACE FUNCTION chkschema(schemaname text) > RETURNS boolean AS > $BODY$ > DECLARE >i boolean; > BEGIN > > EXECUTE 'SELECT e

Re: [GENERAL] passing schema name and table name as parameter functions in postgresql 9.2

2013-06-06 Thread Pavel Stehule
Hello EXECUTE is not expression. You cannot use it inside IF statement. more, you don't need EXECUTE (dynamic DDL) in IF statement in your example. second issue is SQL injection vulnerability Regards Pavel Stehule 2013/6/6 anushasrivastava03 : > I am trying to build a function which check for

[GENERAL] checking schema present or not by passing schema name as parameter

2013-06-06 Thread anushasrivastava03
i am checking if schema present or not and passing schema name dynamically but it's trowing an error : CREATE OR REPLACE FUNCTION chkschema(schemaname text) RETURNS boolean AS $BODY$ DECLARE i boolean; BEGIN EXECUTE 'SELECT exists(select schema_name FROM information_schema.schemat

[GENERAL] passing schema name and table name as parameter functions in postgresql 9.2

2013-06-06 Thread anushasrivastava03
I am trying to build a function which check for the schema and table in database if present then select the table values else create that schema and table and passing schema and table name as parameters of a function. CREATE OR REPLACE FUNCTION master.chkbypram(schemaname text,state text,wallma

Re: [GENERAL] PostgreSQL Synchronous Replication in production

2013-06-06 Thread Richard Huxton
On 06/06/13 11:20, Colin Sloss wrote: I have been testing the differences between asynchronous and synchronous hot standby streaming replication on PostgreSQL 9.2.4. There is some push towards synchronous replication, but I am finding some serious problems, and wonder how other people deal with

Re: [GENERAL] What's a good way to improve this query?

2013-06-06 Thread Jorge Arévalo
Hello, El miércoles 5 de junio de 2013 a las 20:31, Paul Ramsey escribió: > Well, your objects are larger than the page size, so you're getting them out > of the toast tables, not directly out of main storage. You may also have your > type declared as 'main' storage, which means it's zipped up

[GENERAL] PostgreSQL Synchronous Replication in production

2013-06-06 Thread Colin Sloss
Hello, I have been testing the differences between asynchronous and synchronous hot standby streaming replication on PostgreSQL 9.2.4. There is some push towards synchronous replication, but I am finding some serious problems, and wonder how other people deal with them. Action:The Slav