[HACKERS] Passing tabular data around using python functions

2012-07-30 Thread Achim Domma
Hi, I'm just trying to figure out what's possible with Postgresql and Python. One thing that's important for me, would be to pass result sets around to process them further. I have a table like this: create table fps ( docid integer, conceptid integer, rank float4 )

Re: [HACKERS] [PATCH] Support for foreign keys with arrays

2012-07-30 Thread Gabriele Bartolini
Hi guys, it is time to give another go to this patch. I would like to thank everyone for suggestions and ideas expressed through this list. We are happy that Part 0 of the patch has been committed (array_remove() and array_replace() functions), which will be useful in Part 2 (too

Re: [HACKERS] [PATCH] Support for foreign keys with arrays

2012-07-30 Thread Simon Riggs
On 30 July 2012 16:12, Gabriele Bartolini gabriele.bartol...@2ndquadrant.it wrote: * Array Foreign Key * Foreign Key Arrays * ELEMENT Foreign Keys * ... Which one is your favourite? Array Element Foreign Key -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL

Re: [HACKERS] [PATCH] Support for foreign keys with arrays

2012-07-30 Thread Robert Haas
On Mon, Jul 30, 2012 at 11:12 AM, Gabriele Bartolini gabriele.bartol...@2ndquadrant.it wrote: Hi guys, it is time to give another go to this patch. I would like to thank everyone for suggestions and ideas expressed through this list. We are happy that Part 0 of the patch has been

[HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Pavel Stehule
Hello I seen nice trick based on window function http://stackoverflow.com/questions/11700930/how-can-i-trim-a-text-array-in-postgresql but isn't it example of wrong evaluation? Result of row_number is not correct Regards Pavel

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Tom Lane
Pavel Stehule pavel.steh...@gmail.com writes: I seen nice trick based on window function http://stackoverflow.com/questions/11700930/how-can-i-trim-a-text-array-in-postgresql but isn't it example of wrong evaluation? Result of row_number is not correct Sure it is ... or at least, you won't

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Thom Brown
On 30 July 2012 17:19, Pavel Stehule pavel.steh...@gmail.com wrote: Hello I seen nice trick based on window function http://stackoverflow.com/questions/11700930/how-can-i-trim-a-text-array-in-postgresql but isn't it example of wrong evaluation? Result of row_number is not correct Looks

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread David Johnston
On Jul 30, 2012, at 12:33, Thom Brown t...@linux.com wrote: On 30 July 2012 17:19, Pavel Stehule pavel.steh...@gmail.com wrote: Hello I seen nice trick based on window function http://stackoverflow.com/questions/11700930/how-can-i-trim-a-text-array-in-postgresql but isn't it example of

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Pavel Stehule
2012/7/30 Thom Brown t...@linux.com On 30 July 2012 17:19, Pavel Stehule pavel.steh...@gmail.com wrote: Hello I seen nice trick based on window function http://stackoverflow.com/questions/11700930/how-can-i-trim-a-text-array-in-postgresql but isn't it example of wrong evaluation? Result

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Josh Berkus
it looks like row_number is evaluated before SRF - this behave is absolutely undefined - for me - more native behave is different evaluation. SRFs which return multiple rows in the SELECT clause have ALWAYS behaved oddly when it comes to row evaluation (LIMIT, COUNT(), etc.). This isn't

Re: [HACKERS] [PATCH] Support for foreign keys with arrays

2012-07-30 Thread Alvaro Herrera
Excerpts from Simon Riggs's message of lun jul 30 11:21:46 -0400 2012: On 30 July 2012 16:12, Gabriele Bartolini gabriele.bartol...@2ndquadrant.it wrote: * Array Foreign Key * Foreign Key Arrays * ELEMENT Foreign Keys * ... Which one is your favourite? Array Element Foreign

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Merlin Moncure
On Mon, Jul 30, 2012 at 11:47 AM, Pavel Stehule pavel.steh...@gmail.com wrote: 2012/7/30 Thom Brown t...@linux.com On 30 July 2012 17:19, Pavel Stehule pavel.steh...@gmail.com wrote: Hello I seen nice trick based on window function

Re: [HACKERS] [PATCH] Support for foreign keys with arrays

2012-07-30 Thread Gabriele Bartolini
Il 30/07/12 19:11, Alvaro Herrera ha scritto: I was going to say the same, except I had ELEMENT as a capitalized word in my mind (and in the docs it'd be within literal). So: Array ELEMENT Foreign Key +1 for me And it can be also interchanged with Array element Foreign Key. -- Gabriele

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Tom Lane
Josh Berkus j...@agliodbs.com writes: it looks like row_number is evaluated before SRF - this behave is absolutely undefined - for me - more native behave is different evaluation. SRFs which return multiple rows in the SELECT clause have ALWAYS behaved oddly when it comes to row evaluation

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Andrew Dunstan
On 07/30/2012 01:18 PM, Tom Lane wrote: My feeling is that SRFs in targetlists are just fundamentally poorly defined, and the answer is to avoid them not try to make them cleaner. Most of the real use-cases for them could be handled in a better-defined, more standard way with LATERAL ... so

Re: [HACKERS] strange evaluation Window function and SRF functions?

2012-07-30 Thread Pavel Stehule
2012/7/30 Tom Lane t...@sss.pgh.pa.us Josh Berkus j...@agliodbs.com writes: it looks like row_number is evaluated before SRF - this behave is absolutely undefined - for me - more native behave is different evaluation. SRFs which return multiple rows in the SELECT clause have ALWAYS

[HACKERS] tzdata2012d

2012-07-30 Thread David Fetter
Folks, I just noticed that there's yet another change to time zones: http://www.iana.org/time-zones Can we slide this into the upcoming point release? When would that be? Cheers, David. -- David Fetter da...@fetter.org http://fetter.org/ Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!:

[HACKERS] cataloguing NOT NULL constraints

2012-07-30 Thread Alvaro Herrera
Hello, Just over a year ago, I posted a patch (based on a previous patch by Bernd Helmle) that attempted to add pg_constraint rows for NOT NULL constraints. http://archives.postgresql.org/message-id/20110707213401.ga27...@alvh.no-ip.org That patch was rather long and complex, as it tried to

Re: [HACKERS] tzdata2012d

2012-07-30 Thread Alvaro Herrera
Excerpts from David Fetter's message of lun jul 30 17:27:46 -0400 2012: Folks, I just noticed that there's yet another change to time zones: http://www.iana.org/time-zones Can we slide this into the upcoming point release? When would that be? Usually, Tom installs the latest timezone

Re: [HACKERS] tzdata2012d

2012-07-30 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com writes: Excerpts from David Fetter's message of lun jul 30 17:27:46 -0400 2012: Can we slide this into the upcoming point release? When would that be? Usually, Tom installs the latest timezone data just before each point release. It's part of the

Re: [HACKERS] [patch] libpq one-row-at-a-time API

2012-07-30 Thread Leon Smith
Hey, this thread was pointed out to me just a few days ago, but I'll start by saying that I think this thread is on exactly the right track. I don't like the callback API, and think that PQsetSingleRowMode should be offered in place of it. But I do have one On Sat, Jun 16, 2012 at 10:22 AM,

Re: [HACKERS] [patch] libpq one-row-at-a-time API

2012-07-30 Thread Jan Wieck
On 7/30/2012 8:11 PM, Leon Smith wrote: One other possibility, Tom Lane fretted ever so slightly about the use of malloc/free per row... what about instead of PQsetSingleRowMode, you have PQsetChunkedRowMode that takes a chunkSize parameter. A chunkSize = 0 would be equivalent to what we

Re: [HACKERS] [patch] libpq one-row-at-a-time API

2012-07-30 Thread Leon Smith
On Mon, Jul 30, 2012 at 9:59 PM, Jan Wieck janwi...@yahoo.com wrote: On 7/30/2012 8:11 PM, Leon Smith wrote: One other possibility, Tom Lane fretted ever so slightly about the use of malloc/free per row... what about instead of PQsetSingleRowMode, you have PQsetChunkedRowMode that takes a

Re: [HACKERS] [patch] libpq one-row-at-a-time API

2012-07-30 Thread Jan Wieck
On 7/30/2012 10:31 PM, Leon Smith wrote: This is not necessarily true, on multiple levels. I mean, some of the programs I write are highly concurrent, and this form of batching would have almost no risk of stalling the network buffer.And the possible use case would be when you are

[HACKERS] [patch] pg_stat_lwlocks view - lwlocks statistics

2012-07-30 Thread Qi Huang
Hi,I was doing patch review for patch of pg_stat_lwlocks view - lwlocks statistics. https://commitfest.postgresql.org/action/patch_view?id=885 The mail for the patch work is at: http://archives.postgresql.org/pgsql-hackers/2012-06/msg01518.php Following the steps on