Re: [GENERAL] design help for performance

2011-12-21 Thread Marc Mamin
> -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of Alban Hertroys > Sent: Mittwoch, 21. Dezember 2011 08:53 > To: Culley Harrelson > Cc: pgsql-general@postgresql.org > Subject: Re: [GENERAL] design help for performanc

[GENERAL] can not use the column after rename

2011-12-21 Thread salah jubeh
Hello, Why I can not do something like this in Postgres.  SELECT 1 as a , 2 as b , a + b as c ; Regards

Re: [GENERAL] can not use the column after rename

2011-12-21 Thread Simon Tokumine
Hi Salah, This is equivalent: WITH numbers AS (SELECT 1 AS a, 2 AS b) SELECT a, b, a+b AS c FROM numbers; S On Wed, Dec 21, 2011 at 11:39 AM, salah jubeh wrote: > Hello, > > Why I can not do something like this in Postgres. > > SELECT 1 as a , 2 as b , a + b as c ; > > Regards > > >

Re: [GENERAL] can not use the column after rename

2011-12-21 Thread salah jubeh
Hello Simon, This question was raised up during writing a query where many columns are a result of long mathematical operations, so I thought why not to rename them and use the new names  instead of repeating the same operations On the row level,  the value of a and b are know, so why we nee

[GENERAL] Cannot connect to 2nd cluster database remotely

2011-12-21 Thread Jacques Lamothe
Hi, I have 2 cluster databases, running on the same host, Linux with redHat. My fist database port is set to default, 5432, but my second database port is set to 5436 in the postgresql.conf file. While everything is ok with local connections, I cannot connect remotely using any of my tools to th

Re: [GENERAL] can not use the column after rename

2011-12-21 Thread Marti Raudsepp
On Wed, Dec 21, 2011 at 15:24, salah jubeh wrote: > Why I can not use it directly  as shown in the example below. > why a and b can not be used as aliases for the column names ? I want to know > the theoretical reason behind it? As far as I know, that's how the SQL standard specifies it. PostgreS

Re: [GENERAL] Cannot connect to 2nd cluster database remotely

2011-12-21 Thread Devrim GÜNDÜZ
On Wed, 2011-12-21 at 13:26 +, Jacques Lamothe wrote: > I have 2 cluster databases, running on the same host, Linux with > redHat. My fist database port is set to default, 5432, but my second > database port is set to 5436 in the postgresql.conf file. While > everything is ok with local connect

Re: [GENERAL] Cannot connect to 2nd cluster database remotely

2011-12-21 Thread Jacques Lamothe
I don’t believe I do. I can connect remotely with my first database that uses the default port 5432 and not with the second one using port 5436. However, I can connect locally to the database and perform any task. [root@vpdb1 ~]# iptables -L Chain INPUT (policy ACCEPT) target prot opt source

Re: [GENERAL] can not use the column after rename

2011-12-21 Thread David Johnston
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of salah jubeh Sent: Wednesday, December 21, 2011 6:39 AM To: pgsql Subject: [GENERAL] can not use the column after rename Hello, Why I can not do something like this in Postgres. SELECT 1

Re: [GENERAL] Cannot connect to 2nd cluster database remotely

2011-12-21 Thread devrim
This message has been digitally signed by the sender. Re___GENERAL__Cannot_connect_to_2nd_cluster_database_remotely.eml Description: Binary data - Hi-Tech Gears Ltd, Gurgaon, India -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make ch

Re: [GENERAL] out of memory error with loading pg_dumpall

2011-12-21 Thread Dara Olson
Below is what the beginning of the log looks like. There area a total of 21,733 lines of errors. Please let me know if I should provide the complete error log file. 2011-12-20 12:10:58 CST LOG: database system was shut down at 2011-12-20 12:10:56 CST 2011-12-20 12:10:58 CST LOG: database s

Re: [GENERAL] can not use the column after rename

2011-12-21 Thread Tom Lane
salah jubeh writes: > On the row level,  the value of a and b are know, so why we need a temporary > table or CTE. Why I can not use it directly  as shown in the example below. > why a and b can not be used as aliases for the column names ? I want to know > the theoretical reason behind it? Th

Re: [GENERAL] out of memory error with loading pg_dumpall

2011-12-21 Thread Tom Lane
"Dara Olson" writes: > This is the first 1/3 of the errors, so hopefully this will help diagnose > where my problem may be. Any help would be greatly appreciated. Well, you didn't show us the error that caused a COPY to fail, but it's pretty obvious that you're attempting to load the dump into

[GENERAL] How to create database with default system locale is set to et_EE.UTF-8

2011-12-21 Thread Andrus
In fresh Debian installation default system locale is set to et_EE.UTF-8 using dpkg-reconfigure locales Postgres is installed using apt-get update apt-get -t squeeze-backports install postgresql-9.1 postgresql-common postgresql-contrib Trying to create database with et_EE.UTF-8 collation and

[GENERAL] [partition table] fetchall or fetchone function can not get the returning rows

2011-12-21 Thread Xiaoning Xu
Hello, I have a problem concerning the partition table. When I store a record into one of the partition and use "RETURNING table_id" or "RETURNING *", I expect the same result when calling fetchall or fetchone function as not using partition. However, it simply returns nothing. Since the seria

Re: [GENERAL] Postgres Logs question

2011-12-21 Thread akp geek
thanks for the help. The way I did it was I have log_statement=all in the postgresql.conf then I have alter user akp set log_statements='none'; Still it writes the log for akp. I am still missing some configuration to make sure I don't write log for the user akp Regards On Tue, Dec 20, 2011

Re: [GENERAL] How to create database with default system locale is set to et_EE.UTF-8

2011-12-21 Thread Adrian Klaver
On Wednesday, December 21, 2011 10:28:24 am Andrus wrote: > In fresh Debian installation default system locale is set to et_EE.UTF-8 > using > > dpkg-reconfigure locales > > Postgres is installed using > > apt-get update > apt-get -t squeeze-backports install postgresql-9.1 postgresql-common > p

[GENERAL] How to escape to quotes on Insert into?

2011-12-21 Thread Andre Lopes
Hi, I need to escape quotes on an insert into that have a quote like this: http://host.com/cond'nast How can I escape " ' " on an insert into? Best Regards, André. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql

Re: [GENERAL] How to escape to quotes on Insert into?

2011-12-21 Thread Bill Moran
In response to Andre Lopes : > Hi, > > I need to escape quotes on an insert into that have a quote like this: > > http://host.com/cond'nast > > How can I escape " ' " on an insert into? It depends: The best way is to pass the string as a parametrized query, then you don't have to escape anyth

Re: [GENERAL] design help for performance

2011-12-21 Thread Culley Harrelson
Thank you so much everyone! Introducing table C was indeed my next step but I was unsure if I was going to be just moving the locking problems from A to C. Locking on C is preferable to locking on A but it doesn't really solve the problem. It sounds like I should expect less locking on C because

Re: [GENERAL] How to escape to quotes on Insert into?

2011-12-21 Thread Andre Lopes
Thanks for your help. It is working. Best Regards, On Wed, Dec 21, 2011 at 9:04 PM, Bill Moran wrote: > In response to Andre Lopes : > >> Hi, >> >> I need to escape quotes on an insert into that have a quote like this: >> >> http://host.com/cond'nast >> >> How can I escape " ' " on an insert int

[GENERAL] [partition table] python fetchall or fetchone function can not get the returning rows

2011-12-21 Thread Xiaoning Xu
Hello, I have a problem concerning the partition table. When I store a record into one of the partition and use "RETURNING table_id" or "RETURNING *", I expect the same result when calling fetchall or fetchone function as not using partition. However, it simply returns nothing. Since the seria

[GENERAL] Why vacumming performed on template1 with initdb command ?

2011-12-21 Thread Raghavendra
Respected, Am in PG 9.0.4. While creating a new cluster with "initdb" command I observed a statement echoing as "vacuuming database template1 ok". Why vacuuming is performed on a new cluster on template1 database. Please share your valuable comments. *Initdb output:* [postgres@test-psql01 bi

Re: [GENERAL] fsync on ext4 does not work

2011-12-21 Thread Havasvölgyi Ottó
Thank you guys for the ideas and suggestions, I will check them. Best regards, Otto

Re: [GENERAL] Escaping input from COPY

2011-12-21 Thread Josh Kupershmidt
On Tue, Dec 20, 2011 at 7:47 PM, Adrian Klaver wrote: > As far as I know you did not get an answer, which is not the same as there > being > no answer:) I think you will find that the escaping is handled for you. I am rather dubious of the claim that "escaping is handled for you" with copy_from(

Re: [GENERAL] [partition table] python fetchall or fetchone function can not get the returning rows

2011-12-21 Thread Misa Simic
Hi Xiaoning, I need to say i don't have experience with RETURNING... So don't know what could be wrong... But the way how we usually deal with same issue is: Serial column has sequence next value as default value... So usually we first take next seq value and in insert we include pk column with t

Re: [GENERAL] Escaping input from COPY

2011-12-21 Thread Roger Leigh
On Wed, Dec 21, 2011 at 06:16:42PM -0500, Josh Kupershmidt wrote: > On Tue, Dec 20, 2011 at 7:47 PM, Adrian Klaver > wrote: > > As far as I know you did not get an answer, which is not the same as there > > being > > no answer:) I think you will find that the escaping is handled for you. > > I

Re: [GENERAL] Why vacumming performed on template1 with initdb command ?

2011-12-21 Thread Tom Lane
Raghavendra writes: > Why vacuuming is performed on a new cluster on template1 database. It's a VACUUM FREEZE, and if we didn't do it we'd have to do the work over again later, separately in every database of the cluster. regards, tom lane -- Sent via pgsql-general mail

Re: [GENERAL] design help for performance

2011-12-21 Thread Misa Simic
Hm... I think result on the end will be the same... I am not sure realation produce any locks on parent table... What produces locks is UPDATE, so is it on table A or C should make no difference... If simple join and count fk is so slow - other option would be materialized view... So it would

[GENERAL] Trying to understand postgres crash

2011-12-21 Thread Hanns Hartman
Hi, I'm running postgres 8.3.17 on a redhat linux mips derivative and I've observed a postgres crash and the subsequent messages in my postgres debug log. 2011-12-21 19:08:49 UTC - LOG: shutting down 2011-12-21 19:08:49 UTC - PANIC: concurrent transaction log activity while database system is s

Re: [GENERAL] Escaping input from COPY

2011-12-21 Thread Adrian Klaver
On Wednesday, December 21, 2011 3:16:42 pm Josh Kupershmidt wrote: > On Tue, Dec 20, 2011 at 7:47 PM, Adrian Klaver wrote: > > As far as I know you did not get an answer, which is not the same as > > there being no answer:) I think you will find that the escaping is > > handled for you. > > I am

Re: [GENERAL] ignore duplicate key while using COPY?

2011-12-21 Thread Yan Chunlu
thanks a lot! On Mon, Dec 19, 2011 at 10:19 PM, Adrian Klaver wrote: > On Sunday, December 18, 2011 10:54:21 pm Yan Chunlu wrote: > > I am using COPY public.table_name FROM STDIN to import data. it is > > very efficient, but if there's any duplicate key exists, the whole > > procedure has been

[GENERAL] Cursor loop - stop current iteration and continue with next iteration

2011-12-21 Thread Dinesh Kumara
Greetings.. Please advice me how to stop current iteration of cursor loop and continue with next iteration . ... contractlistquery = ''; OPEN rec_contractlist FOR EXECUTE contractlistquery;     LOOP     FETCH rec_contractlist INTO  contract_from_date,contract_to_date,contract_inv_type,con

[GENERAL] Help with Multiple Cluster on same host

2011-12-21 Thread Jacques Lamothe
Hi, I have 2 cluster databases, running on the same host, Linux with redHat. My fist database port is set to default but my second database port is set to 5436 in the postgresql.conf file. While everything is ok with local connections, I cannot connect using any of my tools to the second databas

[GENERAL] [partition table] fetchall or fetchone function can not get the returning rows

2011-12-21 Thread Xiaoning Xu
Hello, I have a problem concerning the partition table. When I store a record into one of the partition and use "RETURNING table_id" or "RETURNING *", I expect the same result when calling fetchall or fetchone function as not using partition. However, it simply returns nothing. Since the ser

Re: [GENERAL] Help with Multiple Cluster on same host

2011-12-21 Thread David Morton
The first and most obvious check will be the pg_hba.conf file for the allowed hosts ... these files are specific to the instance. From: Jacques Lamothe To: "pgsql-general@postgresql.org" Sent: Wednesday, 21 December 2011 10:02 AM Subject: [GENERAL] Help with

Re: [GENERAL] Cursor loop - stop current iteration and continue with next iteration

2011-12-21 Thread David Johnston
On Dec 21, 2011, at 0:36, Dinesh Kumara wrote: > Greetings.. > > Please advice me how to stop current iteration of cursor loop and continue > with next iteration . > > ... > contractlistquery = ''; > OPEN rec_contractlist FOR EXECUTE contractlistquery; > LOOP > FETCH rec_contractli

Re: [GENERAL] Help with Multiple Cluster on same host

2011-12-21 Thread John R Pierce
On 12/20/11 1:02 PM, Jacques Lamothe wrote: Hi, I have 2 cluster databases, running on the same host, Linux with redHat. My fist database port is set to default but my second database port is set to 5436 in the postgresql.conf file. While everything is ok with local connections, I cannot connec

Re: [GENERAL] [partition table] fetchall or fetchone function can not get the returning rows

2011-12-21 Thread John R Pierce
On 12/21/11 10:24 AM, Xiaoning Xu wrote: Since the serial primary key of my partition table is the FK of some other tables, I need to get the id after each insertion. My solution now is to select the max id from the parent table. I am wondering if there is any other alternatives to solve this p

Re: [GENERAL] Trying to understand postgres crash

2011-12-21 Thread Scott Marlowe
On Wed, Dec 21, 2011 at 5:48 PM, Hanns Hartman wrote: > Hi, > > I'm running postgres 8.3.17 on a redhat linux mips derivative and I've > observed a postgres crash and the subsequent messages in my postgres > debug log. > > 2011-12-21 19:08:49 UTC - LOG:  shutting down > 2011-12-21 19:08:49 UTC -s

Re: [GENERAL] Why vacumming performed on template1 with initdb command ?

2011-12-21 Thread Raghavendra
On Thu, Dec 22, 2011 at 5:00 AM, Tom Lane wrote: > Raghavendra writes: > > Why vacuuming is performed on a new cluster on template1 database. > > It's a VACUUM FREEZE, and if we didn't do it we'd have to do the work > over again later, separately in every database of the cluster. > >