Re: [HACKERS] Composite Datums containing toasted fields are a bad idea(?)

2014-04-25 Thread Heikki Linnakangas
On 04/25/2014 02:40 AM, Tom Lane wrote: * The patch changes HeapTupleGetDatum from a simple inline macro into a function call. This means that third-party extensions will not get protection against creation of toast-pointer-containing composite Datums until they recompile. One consequence of

Re: [HACKERS] Json(b) extension

2014-04-25 Thread Dmitry Dolgov
If your goal is to make this functionality available as soon as possible to users, an external extension is the way to go. No, my primary goal is to create the useful contrib extension and help to the community =) So, I also want to do it as a pgxn extension. On 25 April 2014 00:11, Josh Berkus

Re: [HACKERS] A question about code in DefineRelation()

2014-04-25 Thread Hadi Moshayedi
On second thought I noticed that that makes CREATE FOREIGN TABLE include an OID column in newly-created foreign tables wrongly, when the default_with_oids parameter is set to on. Please find attached a patch. The fix makes sense to me, since in ALTER TABLE SET WITH OIDS we check that the

Re: [HACKERS] Composite Datums containing toasted fields are a bad idea(?)

2014-04-25 Thread Tom Lane
Heikki Linnakangas hlinnakan...@vmware.com writes: On 04/25/2014 02:40 AM, Tom Lane wrote: * The patch changes HeapTupleGetDatum from a simple inline macro into a function call. This means that third-party extensions will not get protection against creation of toast-pointer-containing

Re: [HACKERS] Composite Datums containing toasted fields are a bad idea(?)

2014-04-25 Thread Andres Freund
Hi, On 2014-04-24 19:40:30 -0400, Tom Lane wrote: * Because HeapTupleGetDatum might allocate a new tuple, the wrong thing might happen if the caller changes CurrentMemoryContext between heap_form_tuple and HeapTupleGetDatum. It's fscking ugly to allocate memory in a PG_RETURN_... But I don't

Re: [HACKERS] UUIDs in core WAS: 9.4 Proposal: Initdb creates a single table

2014-04-25 Thread Greg Stark
On Fri, Apr 25, 2014 at 1:43 AM, Marti Raudsepp ma...@juffo.org wrote: Obviously you can't use random(). That's why I talked about cryptographic PRNGs, crypto libraries do proper seeding and generate reliably random numbers all the time. The difficulty lies not really in the PRNG

Re: [HACKERS] Composite Datums containing toasted fields are a bad idea(?)

2014-04-25 Thread Tom Lane
Andres Freund and...@2ndquadrant.com writes: On 2014-04-24 19:40:30 -0400, Tom Lane wrote: * Because HeapTupleGetDatum might allocate a new tuple, the wrong thing might happen if the caller changes CurrentMemoryContext between heap_form_tuple and HeapTupleGetDatum. It's fscking ugly to

Re: [HACKERS] Composite Datums containing toasted fields are a bad idea(?)

2014-04-25 Thread Andres Freund
On 2014-04-25 11:22:09 -0400, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: On 2014-04-24 19:40:30 -0400, Tom Lane wrote: * Because HeapTupleGetDatum might allocate a new tuple, the wrong thing might happen if the caller changes CurrentMemoryContext between heap_form_tuple

Re: [HACKERS] Composite Datums containing toasted fields are a bad idea(?)

2014-04-25 Thread Tom Lane
Andres Freund and...@2ndquadrant.com writes: The case I am worried most about is queries like: SELECT a, b FROM f WHERE f ROW(38, 'whatever') ORDER BY f; I've seen such generated by a some query generators for paging. But I guess that's something we're going to have to accept. Meh ... is it

Re: [HACKERS] Composite Datums containing toasted fields are a bad idea(?)

2014-04-25 Thread Andres Freund
On 2014-04-25 12:05:17 -0400, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: The case I am worried most about is queries like: SELECT a, b FROM f WHERE f ROW(38, 'whatever') ORDER BY f; I've seen such generated by a some query generators for paging. But I guess that's

Re: [HACKERS] Composite Datums containing toasted fields are a bad idea(?)

2014-04-25 Thread Andres Freund
On 2014-04-25 18:25:44 +0200, Andres Freund wrote: On 2014-04-25 12:05:17 -0400, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: The case I am worried most about is queries like: SELECT a, b FROM f WHERE f ROW(38, 'whatever') ORDER BY f; I've seen such generated by a some

Re: [HACKERS] Clock sweep not caching enough B-Tree leaf pages?

2014-04-25 Thread Peter Geoghegan
I've now done a non-limited comparative benchmark of master against the patch (once again, with usage_count starting at 6, and BM_MAX_USAGE_COUNT at 30) with a Gaussian distribution. Once again, the distribution threshold used was consistently 5.0, causing the patched pgbench to report for each

Re: [HACKERS] UUIDs in core WAS: 9.4 Proposal: Initdb creates a single table

2014-04-25 Thread Josh Berkus
On 04/24/2014 05:23 PM, Marti Raudsepp wrote: On Thu, Apr 24, 2014 at 8:40 PM, Josh Berkus j...@agliodbs.com wrote: A pseudo-random UUID is frankly pretty useless to me because (a) it's not really unique This is FUD. A pseudorandom UUID contains 122 bits of randomness. As long as you can

Re: [HACKERS] UUIDs in core WAS: 9.4 Proposal: Initdb creates a single table

2014-04-25 Thread David Fetter
On Fri, Apr 25, 2014 at 10:58:29AM -0700, Josh Berkus wrote: On 04/24/2014 05:23 PM, Marti Raudsepp wrote: On Thu, Apr 24, 2014 at 8:40 PM, Josh Berkus j...@agliodbs.com wrote: A pseudo-random UUID is frankly pretty useless to me because (a) it's not really unique This is FUD. A

Re: [HACKERS] Review: ECPG FETCH readahead

2014-04-25 Thread Boszormenyi Zoltan
2014-04-24 15:19 keltezéssel, Boszormenyi Zoltan írta: 2014-04-24 14:50 keltezéssel, Michael Meskes írta: Thanks an awful lot Antonin. Committer availability might well be the issue, but missing review probably too. Yes, you're right. If my taks is mostly one last glance and a commit I will

[HACKERS] Two minor bugs in GIN fast insertion WAL-logging

2014-04-25 Thread Heikki Linnakangas
(more fruit from my little page-image-comparison hack) WAL replay of filling a GIN fast list page is a bit funky. I believe there are two bugs in it, but they're both harmless: writeListPage function initializes the page, and adds a bunch of tuples to it. All the tuples are included in the

[HACKERS] Planned downtime @ Rackspace

2014-04-25 Thread Stephen Frost
Greetings, As some may be aware, we are currently working with Rackspace to upgrade the PostgreSQL infrastructure systems which they graciously host for us. As part of these upgrades there will be downtime for systems hosted there. Our first planned downtime will be for ~ 2 hours on

[HACKERS] Expression indexes ignore typmod of expression

2014-04-25 Thread Tom Lane
A Salesforce colleague asked me why, for something like regression=# create table foo1 (f1 char(15), f2 char(15)); CREATE TABLE regression=# create index on foo1((case when f1'z' then f1 else f2 end)); CREATE INDEX regression=# \d foo1_f2_idx Index public.foo1_f2_idx Column | Type

Re: [HACKERS] Expression indexes ignore typmod of expression

2014-04-25 Thread Andres Freund
Hi, On 2014-04-25 17:05:26 -0400, Tom Lane wrote: A Salesforce colleague asked me why, for something like the index column ends up as bpchar and not char(15). The CASE expression does get resolved as char(15), but it turns out that index.c just ignores that. I've seen that before but

Re: [HACKERS] [GENERAL] aggregate returning anyarray and 'cannot determine result data type'

2014-04-25 Thread Tomas Vondra
On 23.4.2014 16:07, Tom Lane wrote: To be concrete: let's add a new boolean parameter with the semantics of final function takes extra dummy arguments (default false). There would need to be one for the separate moving-aggregate final function too, of course. The best naming idea I've got

Re: [HACKERS] Expression indexes ignore typmod of expression

2014-04-25 Thread Tom Lane
Andres Freund and...@2ndquadrant.com writes: On 2014-04-25 17:05:26 -0400, Tom Lane wrote: I think this is just a hangover from before we paid much attention to expression typmods at all, and propose the attached patch. Any chance it could cause problems with stored trees being different

Re: [HACKERS] [GENERAL] aggregate returning anyarray and 'cannot determine result data type'

2014-04-25 Thread Tom Lane
Tomas Vondra t...@fuzzy.cz writes: On 23.4.2014 16:07, Tom Lane wrote: To be concrete: let's add a new boolean parameter with the semantics of final function takes extra dummy arguments (default false). There would need to be one for the separate moving-aggregate final function too, of

Re: [HACKERS] Expression indexes ignore typmod of expression

2014-04-25 Thread Andres Freund
On 2014-04-25 17:19:00 -0400, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: On 2014-04-25 17:05:26 -0400, Tom Lane wrote: I think this is just a hangover from before we paid much attention to expression typmods at all, and propose the attached patch. Any chance it could

Re: [HACKERS] slow startup due to LWLockAssign() spinlock

2014-04-25 Thread Andres Freund
On 2014-04-24 23:28:14 +0200, Andres Freund wrote: On 2014-04-24 12:43:13 -0400, Tom Lane wrote: Andres Freund and...@2ndquadrant.com writes: On 2014-04-24 11:02:44 -0400, Tom Lane wrote: FWIW, I like the LWLockAssignBatch idea a lot better than the currently proposed patch.

[HACKERS] Decrease MAX_BACKENDS to 2^16

2014-04-25 Thread Andres Freund
Hi, Currently the maximum for max_connections (+ bgworkers + autovacuum) is defined by #define MAX_BACKENDS0x7f which unfortunately means that some things like buffer reference counts need a full integer to store references. Since there's absolutely no sensible scenario for setting

[HACKERS] Hashable custom types

2014-04-25 Thread Paul Ramsey
When trying to write a recursive CTE using the PostGIS geometry type, I was told this: ERROR: could not implement recursive UNION DETAIL: All column datatypes must be hashable. Is it possible to make custom types hashable? There's no hook in the CREATE TYPE call for a hash function, but can

Re: [HACKERS] Hashable custom types

2014-04-25 Thread Peter Geoghegan
On Fri, Apr 25, 2014 at 4:47 PM, Paul Ramsey pram...@cleverelephant.ca wrote: Is it possible to make custom types hashable? There's no hook in the CREATE TYPE call for a hash function, but can one be hooked up somewhere else? In an operator? See 35.14.6., System Dependencies on Operator