Re: [HACKERS] confusing checkpoint_flush_after / bgwriter_flush_after

2016-11-25 Thread Fabien COELHO
Maybe something like the following, or maybe it should include "bufmgr.h", not sure. As-is this patch seems like a maintenance time bomb; it really needs to use the #defines rather than have the values hard-wired in. However, just including bufmgr.h in frontend code doesn't work, so I moved t

Re: [HACKERS] References to arbitrary database objects that are suitable for pg_dump

2016-11-25 Thread Jim Nasby
On 11/25/16 6:00 PM, Tom Lane wrote: OIDs? Then use pg_describe_object() to turn that into text when dumping. How would I get pg_dump to do that? I could certainly make this work if there was some way to customize how pg_dump dumps things, but AFAIK there's no way to do that, even with exte

Re: [HACKERS] macaddr 64 bit (EUI-64) datatype support

2016-11-25 Thread Tom Lane
Haribabu Kommi writes: > Currently the casting is supported from macaddr to macaddr8, but not the > other way. This is because, not all 8 byte MAC addresses can be converted > into 6 byte addresses. Well, yeah, so you'd throw an error if it can't be converted. This is no different from casting i

[HACKERS] Skipping PgStat_FunctionCallUsage for many expressions

2016-11-25 Thread Andres Freund
Hi, while working on my faster expression evaluation stuff I noticed that a lot of expression types that call functions don't call the necessary functions to make track_functions work. ExecEvalFunc/ExecEvalOper (via ExecMakeFunctionResultNoSets) call pgstat_init_function_usage/pgstat_end_function

Re: [HACKERS] make default TABLESPACE belong to target table.

2016-11-25 Thread Michael Paquier
On Sat, Nov 26, 2016 at 11:25 AM, Amos Bird wrote: > How about making a storage parameter "default_tablespace" that also > covers CREATE INDEX and other stuff? That's exactly the idea, the one at relation-level gets priority on the global one defined in postgresql.conf. -- Michael -- Sent via

Re: [HACKERS] make default TABLESPACE belong to target table.

2016-11-25 Thread Amos Bird
> The only scenario where this would be useful is when using ALTER TABLE > ADD CONSTRAINT in which case a fresh index is built (not USING INDEX). > That's a bit narrow, because it would mean that you would either > append a TABLESPACE clause to this existing clause, or create a > storage parameter

Re: [HACKERS] make default TABLESPACE belong to target table.

2016-11-25 Thread Amos Bird
> I had a similar problem in writing the range_partitioning extension: CREATE > TABLE y (LIKE x INCLUDING ALL) didn't set the tablespace of y to match x. > I don't have a solution, I'm just indicating a similar need in userland. Cool, I didn't think of that. It seems this feature is at least usef

Re: [HACKERS] User-defined Operator Pushdown and Collations

2016-11-25 Thread Paul Ramsey
On Fri, Nov 25, 2016 at 11:30 AM, Paul Ramsey wrote: > I've been trying to figure out an issue with operators not being pushed > down for user defined types, in this case "hstore". TL;DR: > > hstore=# explain (verbose) select * from hs_fdw where h -> 'a' = '1'; > QUE

Re: [HACKERS] References to arbitrary database objects that are suitable for pg_dump

2016-11-25 Thread Tom Lane
Jim Nasby writes: > The challenge I'm running into is finding a way to store a reference to > an arbitrary object that will survive a rename as well as working with > pg_dump. Can't you do it like pg_depend does, that is store the class and object OIDs? Then use pg_describe_object() to turn th

Re: [HACKERS] Fixed pg_class refcache leak when the meta tuple in pg_class in invalid.

2016-11-25 Thread Tom Lane
Ming Li writes: > In some cases the meta tuple in pg_class for a specific relation is > invalid, which will cause relcache leak, and then report warning: > WARNING: relcache reference leak: relation "pg_class" not closed. > The diff file in the attachment can fix this problem. I'm confused. Rel

Re: [HACKERS] confusing checkpoint_flush_after / bgwriter_flush_after

2016-11-25 Thread Tom Lane
Fabien COELHO writes: >>> What we do in some similar cases is put the burden on initdb to fill in >>> the correct value by modifying postgresql.conf.sample appropriately. >>> It seems like that could be done easily here too. And it'd be a >>> back-patchable fix. >> I haven't realized initdb can

[HACKERS] References to arbitrary database objects that are suitable for pg_dump

2016-11-25 Thread Jim Nasby
I'm working on an extension that is meant to enable metaprogramming within Postgres, namely around the creation of objects. For example, a "lookup table" class might create a table, grant specific permissions on that table, and create several functions to support getting data from the table. Yo

Re: [HACKERS] confusing checkpoint_flush_after / bgwriter_flush_after

2016-11-25 Thread Fabien COELHO
What we do in some similar cases is put the burden on initdb to fill in the correct value by modifying postgresql.conf.sample appropriately. It seems like that could be done easily here too. And it'd be a back-patchable fix. I haven't realized initdb can do that. I agree that would be the bes

Re: [HACKERS] [sqlsmith] Failed assertion in parallel worker in ExecInitSubPlan

2016-11-25 Thread Tom Lane
Amit Kapila writes: > On Fri, Nov 25, 2016 at 10:33 AM, Tom Lane wrote: >> The impression I got in poking at this for a few minutes, before >> going off to stuff myself with turkey, was that we were allowing >> a SubqueryScanPath to mark itself as parallel-safe even though the >> resulting plan n

Re: [HACKERS] UNDO and in-place update

2016-11-25 Thread Greg Stark
On 24 November 2016 at 23:03, Robert Haas wrote: >> For snapshot isolation Oracle has yet a *third* copy of the data in a >> space called the "rollback segment(s)". > > My understanding is that this isn't correct. I think the rollback > segments are what they call the thing that stores UNDO. See

Re: [HACKERS] confusing checkpoint_flush_after / bgwriter_flush_after

2016-11-25 Thread Tomas Vondra
On 11/25/2016 06:10 PM, Tom Lane wrote: Fabien COELHO writes: #checkpoint_flush_after = 0 # 0 disables, # default is 256kB on linux, 0 otherwise I find this pretty confusing, because for all other GUCs in the file, the commented-out value is the default one. I

[HACKERS] User-defined Operator Pushdown and Collations

2016-11-25 Thread Paul Ramsey
I've been trying to figure out an issue with operators not being pushed down for user defined types, in this case "hstore". TL;DR: hstore=# explain (verbose) select * from hs_fdw where h -> 'a' = '1'; QUERY PLAN

Re: [HACKERS] UNDO and in-place update

2016-11-25 Thread Bruce Momjian
On Thu, Nov 24, 2016 at 12:23:28PM -0500, Robert Haas wrote: > I agree up to a point. I think we need to design our own system as > well as we can, not just copy what others have done. For example, the > design I sketched will work with all of PostgreSQL's existing index > types. You need to mod

Re: [HACKERS] make default TABLESPACE belong to target table.

2016-11-25 Thread Corey Huinker
> > I'd like to implement this small feature --- making table's auxiliary > structures store their data to the target table's tablespace by default. > I've done a thorough search over the mailing list and there is nothing > relevant. Well I may miss some corners :-) > I had a similar problem in wr

Re: [HACKERS] confusing checkpoint_flush_after / bgwriter_flush_after

2016-11-25 Thread Tom Lane
Fabien COELHO writes: >> #checkpoint_flush_after = 0 # 0 disables, >> # default is 256kB on linux, 0 otherwise >> I find this pretty confusing, because for all other GUCs in the file, the >> commented-out value is the default one. In this case that would mean "0",

Re: [HACKERS] proposal: session server side variables

2016-11-25 Thread Craig Ringer
On 14 October 2016 at 23:09, Pavel Stehule wrote: >> but only within the session, right? You're not proposing some kind of >> inter-backend IPC where one backend sets a session var and another >> backend accesses it and sees the value set by the first session? > > In this moment I propose only lo

Re: [HACKERS] confusing checkpoint_flush_after / bgwriter_flush_after

2016-11-25 Thread Tomas Vondra
On 11/25/2016 04:40 PM, Fabien COELHO wrote: Hello Tomas, While the 9.6 cat is out of the bag, I think we can fix this quite easily - use "-1" to specify the default value should be used, and use that in the sample file. This won't break any user configuration. Although I understand the issu

[HACKERS] Fixed pg_class refcache leak when the meta tuple in pg_class in invalid.

2016-11-25 Thread Ming Li
Hi all, In some cases the meta tuple in pg_class for a specific relation is invalid, which will cause relcache leak, and then report warning: WARNING: relcache reference leak: relation "pg_class" not closed. The diff file in the attachment can fix this problem. diff --git a/src/backend/utils/cach

Re: [HACKERS] confusing checkpoint_flush_after / bgwriter_flush_after

2016-11-25 Thread Fabien COELHO
Hello Tomas, While the 9.6 cat is out of the bag, I think we can fix this quite easily - use "-1" to specify the default value should be used, and use that in the sample file. This won't break any user configuration. Although I understand the issue, I'm not sure about -1 as a special value to

Re: [HACKERS] UNDO and in-place update

2016-11-25 Thread Amit Kapila
On Fri, Nov 25, 2016 at 8:03 PM, Amit Kapila wrote: >> > > Another way to do is to write UNDO log for split operation (with exact > record locations on pages that are split) so that you don't need to > perform this expensive search operation. I can understand writing > UNDO for split could be cos

Re: [HACKERS] proposal: session server side variables

2016-11-25 Thread Pavel Stehule
Hi 2016-10-14 9:56 GMT+02:00 Craig Ringer : > On 14 October 2016 at 13:30, Pavel Stehule > wrote: > > Hi, > > > > long time I working on this topic. Session server side variables are one > > major missing feature in PLpgSQL. Now I hope, I can summarize requests > for > > implementation in Postgr

Re: [HACKERS] UNDO and in-place update

2016-11-25 Thread Amit Kapila
On Thu, Nov 24, 2016 at 10:09 PM, Robert Haas wrote: > > I don't really understand how a system of this type copes with page > splits. Suppose there are entries 1000, 2000, ..., 1e6 in the btree. > I now start two overlapping transactions, one inserting all the > positive odd values < 1e6 and the

Re: [HACKERS] make default TABLESPACE belong to target table.

2016-11-25 Thread Michael Paquier
On Fri, Nov 25, 2016 at 10:47 PM, Amos Bird wrote: >> So you would like locate those index tablespaces into the same >> tablespace as its parent relation when the index is created for a >> unique index or as a primary key? > > Yes, and I'd like this behavior take effect when default_tablespace is

Re: [HACKERS] make default TABLESPACE belong to target table.

2016-11-25 Thread Amos Bird
> So you would like locate those index tablespaces into the same > tablespace as its parent relation when the index is created for a > unique index or as a primary key? Yes, and I'd like this behavior take effect when default_tablespace is set to something like "parent". > But what would be the

Re: [HACKERS] [sqlsmith] Failed assertion in parallel worker in ExecInitSubPlan

2016-11-25 Thread Amit Kapila
On Fri, Nov 25, 2016 at 10:33 AM, Tom Lane wrote: > Amit Kapila writes: >> On Fri, Nov 25, 2016 at 3:26 AM, Andreas Seltenreich >> wrote: >>> just caught another InitPlan below Gather with the recent patches in >>> (master as of 4cc6a3f). Recipe below. > >> I think this problem exists since co

Re: [HACKERS] make default TABLESPACE belong to target table.

2016-11-25 Thread Michael Paquier
On Fri, Nov 25, 2016 at 4:48 PM, Amos Bird wrote: > I've been using postgres for a long time. Recently I'm doing table > sharding over a bunch of pgsql instances. I'm using multiple tablespaces > one per disk to utilize all the IO bandwidth. Things went on pretty > well, however there is a trouble

Re: [HACKERS] Creating a DSA area to provide work space for parallel execution

2016-11-25 Thread Thomas Munro
On Fri, Nov 25, 2016 at 4:32 AM, Dilip Kumar wrote: > I have one more question, > > In V1 we were calling dsa_detach in ExecParallelCleanup and in > ParallelQueryMain, but it's removed in v2. > > Any specific reason ? > Does this need to be used differently ? > > ExecParallelCleanup(ParallelExecu

Re: [HACKERS] confusing checkpoint_flush_after / bgwriter_flush_after

2016-11-25 Thread Tomas Vondra
On 11/25/2016 01:20 PM, Fabien COELHO wrote: Hello Tomas, #checkpoint_flush_after = 0 # 0 disables, # default is 256kB on linux, 0 otherwise I find this pretty confusing, because for all other GUCs in the file, the commented-out value is the default one. In th

Re: [HACKERS] confusing checkpoint_flush_after / bgwriter_flush_after

2016-11-25 Thread Fabien COELHO
Hello Tomas, #checkpoint_flush_after = 0 # 0 disables, # default is 256kB on linux, 0 otherwise I find this pretty confusing, because for all other GUCs in the file, the commented-out value is the default one. In this case that would mean "0", disabling the fl

Re: [HACKERS] Typo in comment

2016-11-25 Thread Magnus Hagander
On Fri, Nov 25, 2016 at 4:10 AM, Thomas Munro wrote: > Hi > > Here is a tiny patch to fix a typo in execParallel.c. > Applied, thanks. -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/

Re: [HACKERS] Declarative partitioning - another take

2016-11-25 Thread Amit Langote
On 2016/11/25 11:44, Robert Haas wrote: > On Thu, Nov 24, 2016 at 6:13 AM, Amit Langote wrote: >> Also, it does nothing to help the undesirable situation that one can >> insert a row with a null partition key (expression) into any of the range >> partitions if targeted directly, because of how Exec

Re: [HACKERS] Broken SSL tests in master

2016-11-25 Thread Mithun Cy
On Fri, Nov 25, 2016 at 12:03 PM, Andreas Karlsson wrote: > Another thought about this code: should we not check if it is a unix socket first before splitting the host? While I doubt that it is common to have a unix >socket in a directory with comma in the path it is a bit annoying that we no long

Re: [HACKERS] Declarative partitioning - another take

2016-11-25 Thread Amit Langote
On 2016/11/25 13:51, Ashutosh Bapat wrote: >> >> I assume you meant "...right after the column name"? >> >> I will modify the grammar to allow that way then, so that the following >> will work: >> >> create table p1 partition of p ( >> a primary key >> ) for values in (1); >> > > That seems t

Re: [HACKERS] Random PGDLLIMPORTing

2016-11-25 Thread Craig Ringer
On 25 November 2016 at 14:16, Tom Lane wrote: > Craig Ringer writes: >> PGDLLIMPORT is free, so the question should be "is there a reason not >> to add it here?". > > TBH, my basic complaint about it is that I do not like Microsoft's tool > chain assuming that it's entitled to demand that people