[HACKERS] Set new system identifier using pg_resetxlog

2014-06-13 Thread Petr Jelinek
Hello, attached is a simple patch which makes it possible to change the system identifier of the cluster in pg_control. This is useful for individualization of the instance that is started on top of data directory produced by pg_basebackup - something that's helpful for logical replication se

[HACKERS] Built-in binning functions

2014-06-13 Thread Petr Jelinek
Hello, here is a patch implementing varwidth_bucket (naming is up for discussion) function which does binning with variable bucket width. The use-cases are same as for width_bucket (=data analytics, mainly histograms), the difference is that width_bucket uses buckets of same width but the var

Re: [HACKERS] Something flaky in the "relfilenode mapping" infrastructure

2014-06-13 Thread Tom Lane
Noah Misch writes: > On Thu, Jun 12, 2014 at 10:50:44PM -0400, Tom Lane wrote: >> Alternatively, we could do something like you suggest but adjust the >> second join so that it suppresses only rows in which mapped_oid is null >> *and* there's no longer a matching OID in pg_class. That would provi

Re: [HACKERS] Something flaky in the "relfilenode mapping" infrastructure

2014-06-13 Thread Noah Misch
On Thu, Jun 12, 2014 at 10:50:44PM -0400, Tom Lane wrote: > Alternatively, we could do something like you suggest but adjust the > second join so that it suppresses only rows in which mapped_oid is null > *and* there's no longer a matching OID in pg_class. That would provide > additional confidenc

Re: [HACKERS] ALTER TABLESPACE MOVE command tag tweak

2014-06-13 Thread Tom Lane
Alvaro Herrera writes: > The problem in this particular case is that TABLESPACE is a "global" > object, thus not supported; but ALTER TABLESPACE MOVE is a command that > modifies tables (which *are* supported), not tablespaces. > ALTER TABLESPACE MOVE is a glorified ALTER TABLE. If ALTER TABLESP

Re: [HACKERS] ALTER TABLESPACE MOVE command tag tweak

2014-06-13 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera writes: > > The ALTER TABLESPACE MOVE command affects tables, not tablespaces; and > > as such, I think event triggers should support that command. I'm not > > proposing to change event triggers at this stage, but since IMO we will > > want to do that in 9.5, we n

Re: [HACKERS] replicating DROP commands across servers

2014-06-13 Thread Alvaro Herrera
Here's a patch implementing the proposed idea. This is used in the Bidirectional Replication stuff by Simon/Andres; it works well. One thing of note is that I added output flags for "normal" and "original", which mostly come from performDeletion flags. This let one select only such objects when

Re: [HACKERS] ALTER TABLESPACE MOVE command tag tweak

2014-06-13 Thread Tom Lane
Alvaro Herrera writes: > The ALTER TABLESPACE MOVE command affects tables, not tablespaces; and > as such, I think event triggers should support that command. I'm not > proposing to change event triggers at this stage, but since IMO we will > want to do that in 9.5, we need it to have a different

Re: [HACKERS] How to change the pgsql source code and build it??

2014-06-13 Thread Shreesha
Like Tom said, just setting the the configure option doesn't let the root user in. Looks like lot more changes are required. Tom, according to you, what do you think would be my best bet to allow the root user initialize and start the database server? Thanks, Shreesha. On Fri, Jun 13, 2014 at 9

[HACKERS] ALTER TABLESPACE MOVE command tag tweak

2014-06-13 Thread Alvaro Herrera
The ALTER TABLESPACE MOVE command affects tables, not tablespaces; and as such, I think event triggers should support that command. I'm not proposing to change event triggers at this stage, but since IMO we will want to do that in 9.5, we need it to have a different command tag than plain ALTER TA

Re: [HACKERS] How to change the pgsql source code and build it??

2014-06-13 Thread Shreesha
@Fabrizio de Royes Mello, Even upon making changes as per your suggestion, I could see that initdb is failing for the same reason: *** /mswitch/pgsql/bin # ./initdb -D ../data/ The files

Re: [HACKERS] Clarification of FDW API Documentation

2014-06-13 Thread Tom Lane
Jason Petersen writes: > Imagine if `BeginForeignScan` set up a remote cursor and `IterateForeignScan` > just fetched _one tuple at a time_ (unlike the current behavior where they are > fetched in batches). The tuple would be passed to `ExecForeignDelete` (as is > required), but the remote cursor

[HACKERS] Clarification of FDW API Documentation

2014-06-13 Thread Jason Petersen
I've been deep in the FDW APIs lately and have come up with a couple of questions about the [user-facing documentation][1]. # Requirement that DELETE use junk columns The bit I'm confused by is the parenthetical in this bit at the end of the section on `AddForeignUpdateTargets`: > If the AddFore

Re: [HACKERS] unable to attach client process to postgresql server using gdb

2014-06-13 Thread Robert Haas
On Fri, Jun 13, 2014 at 1:42 AM, Rajmohan C wrote: >I am working with PostgreSQL 9.3.4 source using Eclipse IDE in ubuntu > 14.04. I am facing a problem in attaching client process to postgresql > server using gdb to debug. When I start the postmaster then I connect to it > from client on a te

Re: [HACKERS] How to change the pgsql source code and build it??

2014-06-13 Thread Tom Lane
=?UTF-8?Q?Fabr=C3=ADzio_de_Royes_Mello?= writes: > On Thu, Jun 12, 2014 at 10:59 PM, Kyotaro HORIGUCHI < > horiguchi.kyot...@lab.ntt.co.jp> wrote: >> Try replacing these conditions with "(0 && geteuid() == 0)" and >> you would see it run as root. > Maybe a compile option like '--enable-run-as-roo

Re: [HACKERS] How to change the pgsql source code and build it??

2014-06-13 Thread Fabrízio de Royes Mello
On Thu, Jun 12, 2014 at 10:59 PM, Kyotaro HORIGUCHI < horiguchi.kyot...@lab.ntt.co.jp> wrote: > Hi, > > > I need to port pgsql onto a controller which doesn't have a framework of > > creating multiple users for administrative purposes. The entire > controller > > is managed by a single root user a

Re: [HACKERS] Audit of logout

2014-06-13 Thread David G Johnston
Tom Lane-2 wrote > Another answer is to make both variables PGC_SIGHUP, on the grounds > that it doesn't make much sense for them not to be applied system-wide; > except that I think there was some idea that logging might be enabled > per-user or per-database using ALTER ROLE/DATABASE. >From a tro

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread David Johnston
On Fri, Jun 13, 2014 at 11:32 AM, Tom Lane wrote: > David G Johnston writes: > > Tom Lane-2 wrote > >> At the very least I think we should stay away from this syntax until > >> the SQL committee understand it better than they evidently do today. > >> I don't want to implement it and then get cau

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Pavel Stehule
2014-06-13 17:32 GMT+02:00 Tom Lane : > David G Johnston writes: > > Tom Lane-2 wrote > >> At the very least I think we should stay away from this syntax until > >> the SQL committee understand it better than they evidently do today. > >> I don't want to implement it and then get caught by a futu

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Alvaro Herrera
Quan Zongliang wrote: > Hi all, > > Please find the attachment. > > By my friend asking, for convenience, > support to define multi variables in single PL/pgSQL line. > > Like this: > > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$ > DECLARE > local_a, local_b, local_c text :=

Re: [HACKERS] make check For Extensions

2014-06-13 Thread David E. Wheeler
On Jun 12, 2014, at 11:40 PM, Fabien COELHO wrote: > I would suggest to add that to https://wiki.postgresql.org/wiki/Todo. > > I may look into it when I have time, over the summer. The key point is that > there is no need for a temporary installation, but only of a temporary > cluster, and to

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Tom Lane
David G Johnston writes: > Tom Lane-2 wrote >> At the very least I think we should stay away from this syntax until >> the SQL committee understand it better than they evidently do today. >> I don't want to implement it and then get caught by a future >> clarification that resolves the issue diffe

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread David G Johnston
Tom Lane-2 wrote > Andres Freund < > andres@ > > writes: >> On 2014-06-13 16:12:36 +0200, Pavel Stehule wrote: >>> Quan' example is 100% valid in SQL/PSM and what I read about ADA then in >>> ADA too. > >> So what? plpgsql is neither language and this doesn't seem to be the way >> to make them a

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Tom Lane
Andres Freund writes: > On 2014-06-13 16:12:36 +0200, Pavel Stehule wrote: >> Quan' example is 100% valid in SQL/PSM and what I read about ADA then in >> ADA too. > So what? plpgsql is neither language and this doesn't seem to be the way > to make them actually closer (which I doubt would be a go

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Pavel Stehule
2014-06-13 16:17 GMT+02:00 Andres Freund : > On 2014-06-13 16:12:36 +0200, Pavel Stehule wrote: > > Quan' example is 100% valid in SQL/PSM and what I read about ADA then in > > ADA too. > > So what? plpgsql is neither language and this doesn't seem to be the way > to make them actually closer (whi

Re: [HACKERS] Audit of logout

2014-06-13 Thread Tom Lane
Fujii Masao writes: > On Thu, Jun 12, 2014 at 8:51 PM, Fujii Masao wrote: >> Some users enable log_disconnections in postgresql.conf to audit all logouts. >> But since log_disconnections is defined with PGC_BACKEND, it can be changed >> at connection start. This means that any client (even nonsup

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Andres Freund
On 2014-06-13 16:12:36 +0200, Pavel Stehule wrote: > Quan' example is 100% valid in SQL/PSM and what I read about ADA then in > ADA too. So what? plpgsql is neither language and this doesn't seem to be the way to make them actually closer (which I doubt would be a good idea in the first place). G

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Pavel Stehule
We can disallow custom initialization when when variables are declared as list. Quan' example is 100% valid in SQL/PSM and what I read about ADA then in ADA too. Regards Pavel 2014-06-13 16:04 GMT+02:00 Tom Lane : > Quan Zongliang writes: > > CREATE OR REPLACE FUNCTION try_mutlivardef() RETU

Re: [HACKERS] Audit of logout

2014-06-13 Thread Fujii Masao
On Thu, Jun 12, 2014 at 8:51 PM, Fujii Masao wrote: > Hi, > > Some users enable log_disconnections in postgresql.conf to audit all logouts. > But since log_disconnections is defined with PGC_BACKEND, it can be changed > at connection start. This means that any client (even nonsuperuser) can freely

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Tom Lane
Quan Zongliang writes: > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$ > DECLARE > local_a, local_b, local_c text := 'a1'; > BEGIN > return local_a || local_b || local_c; > end; > $$ LANGUAGE plpgsql; This does not seem like a terribly good idea from here. The main problem

Re: [HACKERS] rm_desc signature

2014-06-13 Thread Abhijit Menon-Sen
At 2014-06-13 13:39:58 +0200, and...@2ndquadrant.com wrote: > > > void (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec); > > void (*rm_desc) (StringInfo buf, XLogRecord *record); > > > > […] > > +1. I've found this annoying in the past. I like it too. I was just moving some code from pg_xlo

Re: [HACKERS] rm_desc signature

2014-06-13 Thread Fujii Masao
On Fri, Jun 13, 2014 at 8:39 PM, Andres Freund wrote: > On 2014-06-13 14:37:33 +0300, Heikki Linnakangas wrote: >> As part of the WAL-format changing patch I've been working on, I changed the >> signature of the rm_desc function from: >> >> void (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec

Re: [HACKERS] rm_desc signature

2014-06-13 Thread Andres Freund
On 2014-06-13 14:37:33 +0300, Heikki Linnakangas wrote: > As part of the WAL-format changing patch I've been working on, I changed the > signature of the rm_desc function from: > > void (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec); > void (*rm_desc) (StringInfo buf, XLogRecord *record); >

[HACKERS] rm_desc signature

2014-06-13 Thread Heikki Linnakangas
As part of the WAL-format changing patch I've been working on, I changed the signature of the rm_desc function from: void (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec); void (*rm_desc) (StringInfo buf, XLogRecord *record); The WAL-format patch needed that because it added more functions

Re: [HACKERS] pg_resetxlog to clear backup start/end locations.

2014-06-13 Thread Fujii Masao
On Fri, Jun 13, 2014 at 5:08 PM, Kyotaro HORIGUCHI wrote: > Hello, this is a patch that add the function to clear backup > location information to pg_resetxlog. > > As per the discussion held before, this function cannot be back > patched to the older versions than 9.4. And it also slipped over >

Re: [HACKERS] Quantify small changes to predicate evaluation

2014-06-13 Thread Marti Raudsepp
On Fri, Jun 13, 2014 at 12:46 PM, Dennis Butterstein wrote: > I expect my current changes to be resposible for about 0.2-0.3s for this > query but because of the huge time differences I am not able to quantify my > changes. > > Maybe somebody can tell me about a better approach to quantify my chan

[HACKERS] Quantify small changes to predicate evaluation

2014-06-13 Thread Dennis Butterstein
Hello everybody, I am currently trying to squeeze some performance out of the current predicate evaluation implementation. In fact I was able to get some positive results. I have some more points on my developement plan, but I am facing the problem that theses changes will only help very little wh

Re: [HACKERS] Few observations in replication slots related code

2014-06-13 Thread Andres Freund
On 2014-06-13 14:21:33 +0530, Amit Kapila wrote: > On Fri, Jun 13, 2014 at 1:45 PM, Andres Freund > wrote: > > On 2014-06-13 13:01:59 +0530, Amit Kapila wrote: > > > Okay, but if it crashes before saving the persistency to permanent > > > file and there remains a .tmp for this replication slot whi

Re: [HACKERS] Few observations in replication slots related code

2014-06-13 Thread Amit Kapila
On Fri, Jun 13, 2014 at 1:45 PM, Andres Freund wrote: > On 2014-06-13 13:01:59 +0530, Amit Kapila wrote: > > Okay, but if it crashes before saving the persistency to permanent > > file and there remains a .tmp for this replication slot which it created > > during save of this persistency informati

[HACKERS] [PATCH] introduce XLogLockBlockRangeForCleanup()

2014-06-13 Thread Abhijit Menon-Sen
nbtxlog.c:btree_xlog_vacuum() contains the following comment: * XXX we don't actually need to read the block, we just need to * confirm it is unpinned. If we had a special call into the * buffer manager we could optimise this so that if the block is * not in shared_buffers we c

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Michael Paquier
On Fri, Jun 13, 2014 at 4:43 PM, Pavel Stehule wrote: > > > > 2014-06-13 9:41 GMT+02:00 Michael Paquier : > >> On Fri, Jun 13, 2014 at 4:20 PM, Quan Zongliang >> wrote: >> > By my friend asking, for convenience, >> > support to define multi variables in single PL/pgSQL line. >> > >> > Like this:

Re: [HACKERS] Few observations in replication slots related code

2014-06-13 Thread Andres Freund
On 2014-06-13 13:01:59 +0530, Amit Kapila wrote: > On Thu, Jun 12, 2014 at 12:45 PM, Andres Freund > wrote: > > On 2014-06-12 08:55:59 +0530, Amit Kapila wrote: > > > Function pg_create_logical_replication_slot() is trying to > > > save slot twice once during CreateInitDecodingContext() and > > >

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Quan Zongliang
On 06/13/2014 03:42 PM, Ian Barwick wrote: Hi On 14/06/13 16:20, Quan Zongliang wrote: Hi all, Please find the attachment. By my friend asking, for convenience, support to define multi variables in single PL/pgSQL line. Like this: CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS

[HACKERS] pg_resetxlog to clear backup start/end locations.

2014-06-13 Thread Kyotaro HORIGUCHI
Hello, this is a patch that add the function to clear backup location information to pg_resetxlog. As per the discussion held before, this function cannot be back patched to the older versions than 9.4. And it also slipped over 9.4 so proposed in this CF. This simplly erases the backup location i

Re: [HACKERS] WAL replay bugs

2014-06-13 Thread Michael Paquier
On Fri, Jun 13, 2014 at 4:50 PM, Michael Paquier wrote: > On Fri, Jun 13, 2014 at 4:48 PM, Heikki Linnakangas > wrote: >> On 06/13/2014 10:14 AM, Michael Paquier wrote: >>> >>> On Mon, Jun 2, 2014 at 9:55 PM, Michael Paquier >>> wrote: On Wed, Apr 23, 2014 at 9:43 PM, Heikki Linnakanga

Re: [HACKERS] WAL replay bugs

2014-06-13 Thread Michael Paquier
On Fri, Jun 13, 2014 at 4:48 PM, Heikki Linnakangas wrote: > On 06/13/2014 10:14 AM, Michael Paquier wrote: >> >> On Mon, Jun 2, 2014 at 9:55 PM, Michael Paquier >> wrote: >>> >>> On Wed, Apr 23, 2014 at 9:43 PM, Heikki Linnakangas >>> wrote: >>> Perhaps there are parts of what is proposed here

Re: [HACKERS] WAL replay bugs

2014-06-13 Thread Heikki Linnakangas
On 06/13/2014 10:14 AM, Michael Paquier wrote: On Mon, Jun 2, 2014 at 9:55 PM, Michael Paquier wrote: On Wed, Apr 23, 2014 at 9:43 PM, Heikki Linnakangas wrote: Perhaps there are parts of what is proposed here that could be made more generalized, like the masking functions. So do not hesitate

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Pavel Stehule
2014-06-13 9:41 GMT+02:00 Michael Paquier : > On Fri, Jun 13, 2014 at 4:20 PM, Quan Zongliang > wrote: > > By my friend asking, for convenience, > > support to define multi variables in single PL/pgSQL line. > > > > Like this: > > > > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Ian Barwick
Hi On 14/06/13 16:20, Quan Zongliang wrote: > Hi all, > > Please find the attachment. > > By my friend asking, for convenience, > support to define multi variables in single PL/pgSQL line. > > Like this: > > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$ > DECLARE > local_a, l

[HACKERS] Use unique index for longer pathkeys.

2014-06-13 Thread Kyotaro HORIGUCHI
Hello, This is the continuation from the last CF. This patch intends to make PG to use index for longer pathkeys than index columns when, - The index is a unique index. - All index columns are NOT NULL. - The index column list is a subset of query_pathkeys. The use cases for this patch are,

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Michael Paquier
On Fri, Jun 13, 2014 at 4:20 PM, Quan Zongliang wrote: > By my friend asking, for convenience, > support to define multi variables in single PL/pgSQL line. > > Like this: > > CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$ > DECLARE > local_a, local_b, local_c text := 'a1'; > B

Re: [HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Pavel Stehule
Hello + it is natural in almost all languages including ADA - it increases a distance between PL/pgSQL and PL/SQL I am don't think, so this feature is necessary, but I am not against it. Regards Pavel 2014-06-13 9:20 GMT+02:00 Quan Zongliang : > Hi all, > > Please find the attachment. > >

Re: [HACKERS] Few observations in replication slots related code

2014-06-13 Thread Amit Kapila
On Thu, Jun 12, 2014 at 12:45 PM, Andres Freund wrote: > On 2014-06-12 08:55:59 +0530, Amit Kapila wrote: > > Function pg_create_logical_replication_slot() is trying to > > save slot twice once during CreateInitDecodingContext() and > > then in ReplicationSlotPersist(), isn't it better if we can m

Re: [HACKERS] pg_xlogdump --stats

2014-06-13 Thread Abhijit Menon-Sen
At 2014-06-10 18:04:13 +0900, furu...@pm.nttdata.co.jp wrote: > > The function works fine. It is a good to the learning of PostgreSQL. Thanks for having a look. > pg_xlogdump.c: In function ‘XLogDumpStatsRow’: > pg_xlogdump.c:851: warning: format ‘%20llu’ expects type ‘long long unsigned > int’,

[HACKERS] PL/pgSQL support to define multi variables once

2014-06-13 Thread Quan Zongliang
Hi all, Please find the attachment. By my friend asking, for convenience, support to define multi variables in single PL/pgSQL line. Like this: CREATE OR REPLACE FUNCTION try_mutlivardef() RETURNS text AS $$ DECLARE local_a, local_b, local_c text := 'a1'; BEGIN return local_a || local_b ||

Re: [HACKERS] loading .so file at run time

2014-06-13 Thread Michael Paquier
On Fri, Jun 13, 2014 at 3:29 PM, Rajmohan C wrote: > I am working with Postgresql 9.3.4 source using eclipse IDE in ubuntu 14.04. > I have a library file abc.so to be loaded at run time when postgresql server > starts. When I run the server with > > "-D /home/rajmohan/projects/TPCH_database" > >

Re: [HACKERS] API change advice: Passing plan invalidation info from the rewriter into the planner?

2014-06-13 Thread Dean Rasheed
On 13 June 2014 01:13, Stephen Frost wrote: > Greg, all, > > I will reply to the emails in detail when I get a chance but am out of town > at a funeral, so it'll likely be delayed. I did want to echo my agreement > for the most part with Greg and in particular... > > On Thursday, June 12, 2014, Gr