[GENERAL] databse version

2013-06-10 Thread Philipp Kraus
Hello, I'm creating a database and I have got a table with a "version" field. Can I update on structure changes (DDL) like create / update table increment this field automatically? I would like to create a versionizing for my database which counts the changes. IMHO I need a trigger, which is r

Re: [GENERAL] Question on explain

2013-06-10 Thread Enrico Pirozzi
Il 10/06/2013 04:19, Jeff Janes ha scritto: On further thought, that is not strange at all. You have two very selective join conditions, and the planner assumes they are independent, so that it can multiply the selectivities. But in reality they are completely (or almost completely) dependent.

Re: [GENERAL] My function run successfully with cursor, but can't change table

2013-06-10 Thread Kevin Grittner
高健 wrote: > CREATE OR REPLACE Function ... > BEGIN >   BEGIN > UPDATE ... > COMMIT; >   EXCEPTION >   WHEN OTHERS THEN >   END; > END; > But when I select the table again, I found it not changed. > Anybody know the reason, maybe there are some wrong way by > which I use the cursor.

Re: [GENERAL] Postgresql - Currval Vs Session Pool

2013-06-10 Thread Albe Laurenz
Gustavo Amarilla Santacruz wrote: > In the PostgreSQL documentation I found "currval: Return the value most > recently obtained by nextval > for this sequence in the current session " > > In other documentations (pgpool, for example), I found "Connection Pooling > pgpool-II saves connections

Re: [GENERAL] Trouble with replication

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

Re: [GENERAL] Postgresql - Currval Vs Session Pool

2013-06-10 Thread Merlin Moncure
On Sun, Jun 9, 2013 at 10:59 AM, Gustavo Amarilla Santacruz wrote: > Hello, all. > > In the PostgreSQL documentation I found "currval: Return the value most > recently obtained by nextval for this sequence in the current session " > > In other documentations (pgpool, for example), I found "Con

Re: [GENERAL] Postgresql - Currval Vs Session Pool

2013-06-10 Thread Gustavo Amarilla Santacruz
Thank you very much, Laurenz Albe. On Mon, Jun 10, 2013 at 9:21 AM, Albe Laurenz wrote: > Gustavo Amarilla Santacruz wrote: > > In the PostgreSQL documentation I found "currval: Return the value most > recently obtained by nextval > > for this sequence in the current session " > > > > In oth

Re: [GENERAL] Postgresql - Currval Vs Session Pool

2013-06-10 Thread Gustavo Amarilla Santacruz
Thank you, Merlin Moncure. On Mon, Jun 10, 2013 at 10:13 AM, Merlin Moncure wrote: > On Sun, Jun 9, 2013 at 10:59 AM, Gustavo Amarilla Santacruz > wrote: > > Hello, all. > > > > In the PostgreSQL documentation I found "currval: Return the value most > > recently obtained by nextval for this se

Re: [GENERAL] Postgresql - Currval Vs Session Pool

2013-06-10 Thread Gustavo Amarilla Santacruz
On Mon, Jun 10, 2013 at 11:24 AM, Gustavo Amarilla Santacruz < gusama...@gmail.com> wrote: > Thank you, Merlin Moncure. > > > On Mon, Jun 10, 2013 at 10:13 AM, Merlin Moncure wrote: > >> On Sun, Jun 9, 2013 at 10:59 AM, Gustavo Amarilla Santacruz >> wrote: >> > Hello, all. >> > >> > In the Postgr

Re: [GENERAL] My function run successfully with cursor, but can't change table

2013-06-10 Thread Thomas Kellerer
Kevin Grittner wrote on 10.06.2013 15:19: It has nothing to do with the way you are using the cursor; your problem is that you are causing an error by attempting to COMMIT inside a function (which is not allowed). This rolls back the subtransaction defined by the BEGIN/EXCEPTION block. You then

Re: [GENERAL] My function run successfully with cursor, but can't change table

2013-06-10 Thread Alvaro Herrera
Thomas Kellerer wrote: > Kevin Grittner wrote on 10.06.2013 15:19: > >It has nothing to do with the way you are using the cursor; your > >problem is that you are causing an error by attempting to COMMIT > >inside a function (which is not allowed). This rolls back the > >subtransaction defined by t

[GENERAL] why does this not give a syntax error?

2013-06-10 Thread Scott Ribe
pg 9.2: delete from "ExternalDocument" where id = 11825657and "Billed" = 'f'; -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www

Re: [GENERAL] why does this not give a syntax error?

2013-06-10 Thread Tom Lane
Scott Ribe writes: > pg 9.2: > delete from "ExternalDocument" where id = 11825657and "Billed" = 'f'; "11825657and" is not any more lexically ambiguous than "11825657+". It has to be two separate tokens, and that's how it's read. regards, tom lane -- Sent via pgsql-gene

Re: [GENERAL] why does this not give a syntax error?

2013-06-10 Thread Tom Lane
Scott Ribe writes: > On Jun 10, 2013, at 12:52 PM, Tom Lane wrote: >> "11825657and" is not any more lexically ambiguous than "11825657+". >> It has to be two separate tokens, and that's how it's read. > But it's not read correctly. [ shrug... ] Works for me. You want to put together a self-con

Re: [GENERAL] why does this not give a syntax error?

2013-06-10 Thread Scott Ribe
On Jun 10, 2013, at 12:52 PM, Tom Lane wrote: > Scott Ribe writes: >> pg 9.2: >> delete from "ExternalDocument" where id = 11825657and "Billed" = 'f'; > > "11825657and" is not any more lexically ambiguous than "11825657+". > It has to be two separate tokens, and that's how it's read. But it's n

[GENERAL] updatable view

2013-06-10 Thread Sajeev Mayandi
Hi, I am using 9.2. The documentation says that there is no support for updatable view. It suggesting to use the triggers or rule. Can somebody paste the sample code for the same. Thanks, Sajeev

Re: [GENERAL] databse version

2013-06-10 Thread Adrian Klaver
On 06/10/2013 12:52 AM, Philipp Kraus wrote: Hello, I'm creating a database and I have got a table with a "version" field. Can I update on structure changes (DDL) like create / update table increment this field automatically? I would like to create a versionizing for my database which counts the

Re: [GENERAL] databse version

2013-06-10 Thread John R Pierce
On 6/10/2013 12:52 AM, Philipp Kraus wrote: I'm creating a database and I have got a table with a "version" field. Can I update on structure changes (DDL) like create / update table increment this field automatically? I would like to create a versionizing for my database which counts the change

[GENERAL] INSERT RETURNING with values other than inserted ones.

2013-06-10 Thread Aleksandr Furmanov
Hello, I want to insert new values into target table 'a' from source table 'b', and then update table 'b' with ids from table 'a', somewhat like: CREATE TABLE a(id SERIAL, name TEXT); INSERT INTO a (name) VALUES('Jason'); INSERT INTO a (name) VALUES('Peter'); CREATE TABLE b(row_id serial, id INT

Re: [GENERAL] INSERT RETURNING with values other than inserted ones.

2013-06-10 Thread Richard Dunks
If you're just replicating the data from table A into table B, why does it need its own ID number? Wouldn't the table A ID suffice? I'd recommend using the following: CREATE TABLE b AS ( SELECT * FROM a ); This way, you only define the columns and insert the data once, then let Postgres do the

Re: [GENERAL] INSERT RETURNING with values other than inserted ones.

2013-06-10 Thread Aleksandr
Thanks, However I am not just replicating data from 'a' to 'b', I provided simplified example, in reality table 'b' keeps data which are going to be merged into 'a', some rows will be updated, some added. There is some other work has to be done on 'b' before merging into 'a' and that work relies

Re: [GENERAL] databse version

2013-06-10 Thread Scott Marlowe
We use this system for versioning: http://pyrseas.wordpress.com/2011/02/18/sql-database-version-control-%E2%80%93-depesz-versioning/ Works like a champ. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpre

Re: [GENERAL] updatable view

2013-06-10 Thread Raghavendra
On Tue, Jun 11, 2013 at 3:32 AM, Sajeev Mayandi wrote: > Hi, > > I am using 9.2. The documentation says that there is no support for > updatable view. It suggesting to use the triggers or rule. Can somebody > paste the sample code for the same. > > Very well summarized by Craig on SO with links

[GENERAL] Oracle Packages and Stored Procedures - PostgreSQL conversion

2013-06-10 Thread Panneerselvam Posangu
Hi, I have some Oracle Packages and some standalone procedure in Oracle schema. As we are converting our application as PostgreSQL compliant we are looking at these Oracle objects. These packages have no variables declared and consist of a few stored procedures. Please suggest a good approach to

Re: [GENERAL] Oracle Packages and Stored Procedures - PostgreSQL conversion

2013-06-10 Thread Pavel Stehule
Hello 2013/6/11 Panneerselvam Posangu : > Hi, > > I have some Oracle Packages and some standalone procedure in Oracle schema. > As we are converting our application as PostgreSQL compliant we are looking > at these Oracle objects. These packages have no variables declared and > consist of a few st

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

2013-06-10 Thread Toby Corkindale
Perhaps someone with a spare server floating around could install Ubuntu LTS and run some pg-bench benchmarks with the various kernel options? Like you, I'd have to stick to official updates for production systems. -Toby On 07/06/13 15:36, Nikhil G Daddikar wrote: Folks, This is bad news as