[GENERAL] PostgreSQL Inheritance and column mapping

2014-10-02 Thread Achilleas Mantzios
Hi, Was there ever any discussion.thought about being able to follow a non-strict by name column mapping between inherited tables and father tables? If for instance someone wants to build an hierarchy on a schema of tables being defined in an established production system, designed with no

Re: [GENERAL] PostgreSQL Inheritance and column mapping

2014-10-02 Thread John R Pierce
On 10/2/2014 4:51 AM, Achilleas Mantzios wrote: After all, generally speaking invoices have invoice_no's while general docs have doc_no's , right? So I think, the above scenario could be indeed be found a lot of times in systems designed with no OO in mind. database relations are not

Re: [GENERAL] PostgreSQL Inheritance and column mapping

2014-10-02 Thread Tom Lane
Achilleas Mantzios ach...@matrix.gatewaynet.com writes: Was there ever any discussion.thought about being able to follow a non-strict by name column mapping between inherited tables and father tables? No. You could use a view with UNION ALL perhaps. (The subtext here is that past discussion

Re: [GENERAL] table versioning approach (not auditing)

2014-10-02 Thread Adam Brusselback
Testing that now. Initial results are not looking too performant. I have one single table which had 234575 updates done to it. I am rolling back 13093 of them. It's been running 20 min now, using 100% of a single core, and almost 0 disk. No idea how long it'll run at this point. This is on an

Re: [GENERAL] table versioning approach (not auditing)

2014-10-02 Thread Adam Brusselback
Ended up running for 28 min, but it did work as expected. On Thu, Oct 2, 2014 at 10:27 AM, Adam Brusselback adambrusselb...@gmail.com wrote: Testing that now. Initial results are not looking too performant. I have one single table which had 234575 updates done to it. I am rolling back

[GENERAL] Getting my Database name in a C Extension

2014-10-02 Thread Cedric Berger
Hi, I'm writing an extention (FDW), and I need, in my C code, the name of my database (contrib_regression_test for example), and I've two questions: 1) What is the easiest way to get that directly in C? 2) Is there a way to get this information in the SQL extension installation/update scripts

Re: [GENERAL] Getting my Database name in a C Extension

2014-10-02 Thread Tom Lane
Cedric Berger ced...@precidata.com writes: I'm writing an extention (FDW), and I need, in my C code, the name of my database (contrib_regression_test for example), and I've two questions: 1) What is the easiest way to get that directly in C? The usual locution is

[GENERAL] Creating a PL/pgSQL function that returns multiple out parameters and refcursor

2014-10-02 Thread Néstor Boscán
Hi Ho do I create a PL/pgSQL function that returns multiple out parameters and a refcursor. Something like this: create function myfunction(p_cursor out refcursor, p_code out varchar, p_message out varchar) returns record as $$ begin open p_cursor is select * from table; p_code :=

Re: [GENERAL] Postgres tcp_keepalive_xxxx parameters.

2014-10-02 Thread José Luis Rando Calvo
Hi Tom, First of all, thank you for your fast response! I did not try to set up keepalives in client yet. This is a good point. We are using JDBC to connect to PG from JBoss application server. I have seen the JDBC documentation and keepalive can be enabled when creating the connection to the

[GENERAL] Benching Queries

2014-10-02 Thread Jonathan Vanasco
Does anyone have a good solution for benching queries under various conditions, and collecting the EXPLAIN data ? I looked at pgbench, but it doesn't seem to be what I want. My situation is this- - For a given query, there are 3-5 different ways that I can run it. - Each form of the query

[GENERAL] How to find greatest record before known values fast

2014-10-02 Thread Andrus
I’m looking for a way to increase select statement speed in Postgres 9.0. Table has required index present. Desired result can obtained using index (kuupaev,kellaaeg) immediately. However Postgres scans all rows: explain analyze SELECT max( kuupaev||kellaaeg ) as res from

[GENERAL] Creating index on concatenated char columns fails is Postgres 9 (regression)

2014-10-02 Thread Andrus
Steps to reproduce: Run commands create temp table test (kuupaev date, kellaaeg char(5) ) on commit drop; create index test on test ((kuupaev||kellaaeg)); in PostgreSQL 9.3.4, compiled by Visual C++ build 1600, 32-bit Observed result: ERROR: functions in index

[GENERAL] Getting my Database name in a C Extension

2014-10-02 Thread Cedric Berger
Hi, I'm writing an extention (FDW), and I need, in my C code, the name of my database (contrib_regression_test for example), and I've two questions: 1) What is the easiest way to get that directly in C? 2) Is there a way to get this information in the SQL extension installation/update scripts

[GENERAL] installing on mac air development machine

2014-10-02 Thread john.tiger
we've always installed on linux so need help with a new mac air running latest osx in the instructions it shows several methods: 1) enterprisedb (but this does not look open source ?) 2) fink 3) macports 4) source etc what do most use ? thks ps: is there a mac build for 9.4 beta 3 yet ? we

Re: [GENERAL] Getting my Database name in a C Extension

2014-10-02 Thread John R Pierce
On 10/2/2014 8:11 AM, Cedric Berger wrote: I'm writing an extention (FDW), and I need, in my C code, the name of my database (contrib_regression_test for example), and I've two questions: 1) What is the easiest way to get that directly in C? 2) Is there a way to get this information in the SQL

Re: [GENERAL] installing on mac air development machine

2014-10-02 Thread Ian Barwick
On 14/10/03 7:50, john.tiger wrote: we've always installed on linux so need help with a new mac air running latest osx in the instructions it shows several methods: 1) enterprisedb (but this does not look open source ?) 2) fink 3) macports 4) source etc what do most use ? thks

Re: [GENERAL] installing on mac air development machine

2014-10-02 Thread john gale
The GUI installer for Mac OS X downloaded from postgresql.org works fine. ~ john On Oct 2, 2014, at 3:50 PM, john.tiger john.tigernas...@gmail.com wrote: we've always installed on linux so need help with a new mac air running latest osx in the instructions it shows several

Re: [GENERAL] installing on mac air development machine

2014-10-02 Thread Jonathan Vanasco
On Oct 2, 2014, at 7:30 PM, john gale wrote: The GUI installer for Mac OS X downloaded from postgresql.org works fine. Unless you NEED to use the source/etc version, use the GUI installer. Unless you are already on a system where installing from Fink/Macports/Source is commonplace...

Re: [GENERAL] installing on mac air development machine

2014-10-02 Thread Adrian Klaver
On 10/02/2014 03:50 PM, john.tiger wrote: we've always installed on linux so need help with a new mac air running latest osx in the instructions it shows several methods: 1) enterprisedb (but this does not look open source ?) It is just the community version of Postgres behind a graphical

Re: [GENERAL] Creating index on concatenated char columns fails is Postgres 9 (regression)

2014-10-02 Thread Adrian Klaver
On 10/02/2014 01:49 PM, Andrus wrote: Steps to reproduce: Run commands create temp table test (kuupaev date, kellaaeg char(5) ) on commit drop; create index test on test ((kuupaev||kellaaeg)); in PostgreSQL 9.3.4, compiled by Visual C++ build 1600, 32-bit Observed result:

Re: [GENERAL] How to find greatest record before known values fast

2014-10-02 Thread Jim Nasby
So kellaaeg is a time? Your best bet here would be to create an index that is an actual timestamp comprised of both kuupaev and kellaaeg. You could do this with to_timestamp by concatinating both fields together, or it may be easier to replace the space in kellaaeg with a colon and cast it to

Re: [GENERAL] PostgreSQL Inheritance and column mapping

2014-10-02 Thread Jim Nasby
On 10/2/14, 9:00 AM, Tom Lane wrote: Achilleas Mantzios ach...@matrix.gatewaynet.com writes: Was there ever any discussion.thought about being able to follow a non-strict by name column mapping between inherited tables and father tables? No. You could use a view with UNION ALL perhaps.

Re: [GENERAL] How to find greatest record before known values fast

2014-10-02 Thread David G Johnston
Andrus Moor wrote Table has both indexes present but postgres will not use them. Indexes can changed and query can re-written if this helps. Table structure cannot changed. char columns cannot replaced with varchar columns. kuupaev must be date and kellaaeg must be char(5) type. Don't

Re: [GENERAL] installing on mac air development machine

2014-10-02 Thread John R Pierce
On 10/2/2014 4:37 PM, Adrian Klaver wrote: On 10/02/2014 03:50 PM, john.tiger wrote: we've always installed on linux so need help with a new mac air running latest osx in the instructions it shows several methods: 1) enterprisedb (but this does not look open source ?) It is just the

Re: [GENERAL] How to find greatest record before known values fast

2014-10-02 Thread Tom Lane
Jim Nasby jim.na...@bluetreble.com writes: So kellaaeg is a time? Your best bet here would be to create an index that is an actual timestamp comprised of both kuupaev and kellaaeg. The real problem with this query, or at least with the index design, is that the index design isn't accounting for

Re: [GENERAL] installing on mac air development machine

2014-10-02 Thread Steve Atkins
On Oct 2, 2014, at 8:04 PM, John R Pierce pie...@hogranch.com wrote: On 10/2/2014 4:37 PM, Adrian Klaver wrote: On 10/02/2014 03:50 PM, john.tiger wrote: we've always installed on linux so need help with a new mac air running latest osx in the instructions it shows several methods: 1)

Re: [GENERAL] Creating a PL/pgSQL function that returns multiple out parameters and refcursor

2014-10-02 Thread Michael Paquier
On Fri, Oct 3, 2014 at 1:15 AM, Néstor Boscán nesto...@gmail.com wrote: Ho do I create a PL/pgSQL function that returns multiple out parameters and a refcursor. Using a plain RETURN; is just but fine, your output parameters are being set internally in the function: =# create function