Re: [HACKERS] [PATCH] Lockable views

2017-12-28 Thread Yugo Nagata
On Thu, 28 Dec 2017 09:29:11 +0900 (JST) Tatsuo Ishii wrote: > > I didn't want to change the interface of view_query_is_auto_updatable() > > because this might be called from other third-patry software, so I renamed > > this function to view_query_is_auto_updatable_or_lockable() and added the >

TAP test module - PostgresClient

2017-12-28 Thread Kyotaro HORIGUCHI
Hello. It would be useful if we have interactive sessions for TAP tests. My first attempt was apparently unstable one that was using psql. https://www.postgresql.org/message-id/20170720.152533.252230418.horiguchi.kyot...@lab.ntt.co.jp Finally the test for the patch in the thread made not need s

[PATCH] GET DIAGNOSTICS FUNCTION_NAME

2017-12-28 Thread Yugo Nagata
Hi, Attached is a patch to implement a feature to get the current function name by GET DIAGNOSTICS in PL/pgSQL function. Currentyly, we can get call stack by GET DIAGNOSTICS PG_CONTEXT, but we cannot get the function name directly. One of our clients wanted this feature for debugging, and this wa

Re: New gist vacuum.

2017-12-28 Thread Andrey Borodin
Hi hackers! > 19 дек. 2017 г., в 15:58, Andrey Borodin написал(а): > Here is the patch that deletes pages during GiST VACUUM. Here is new version of the patch for GiST VACUUM. There are two main changes: 1. During rescan for page deletion only know to be recently empty pages are rescanned. 2. I'

Why standby restores some WALs many times from archive?

2017-12-28 Thread Victor Yagofarov
Hi, I tried to ask a question in pgsql-general@ but got no response. I have postgres 9.4 standby with archive-based replication (via restore_command). PostgreSQL 9.4.12 on x86_64-unknown-linux-gnu, compiled by gcc (Debian 4.9.2-10) 4.9.2, 64-bit One day I noticed strange behavior in postgres l

Re: [HACKERS] pgbench more operators & functions

2017-12-28 Thread Teodor Sigaev
Here is a rebase after "pow" addition. Huh, you are fast. Investigating your patch I found that all arguments of logical AND/OR and CASE are always evaluated. Seems, it should not be for pair of reasons: - computing of unneeded args could be too expensive - computing of unneeded args could co

Re: Contributing with code

2017-12-28 Thread Peter Eisentraut
On 12/27/17 15:18, Antonio Belloni wrote: > I checked the code of pg_tablespace_databases, defined in > src/backend/utils/adt/misc.c, and see that it uses a much simpler > approach : It just reads the tablespaces directories and return the name > of the directories that represents databases OIDs. 

Re: Contributing some code

2017-12-28 Thread Antonio Belloni
Hi Craig, Ok. I see your point. I'll study the storage internals a little bit more and try to figure out a better approach using the directions you have made available. Regards, Antonio Belloni On Thu, Dec 28, 2017 at 12:51 AM, Craig Ringer wrote: > On 28 December 2017 at 01:40, Antonio Bello

Re: plpgsql function startup-time improvements

2017-12-28 Thread Peter Eisentraut
On 12/27/17 15:38, Tom Lane wrote: > It seems possible that the "promise" technique could be useful for > other plpgsql special variables in future. I thought briefly about > applying it to triggers' NEW and OLD arguments, but desisted because > (a) it's only a win if triggers will commonly not to

Re: [HACKERS] taking stdbool.h into use

2017-12-28 Thread Peter Eisentraut
On 12/27/17 19:47, Michael Paquier wrote: >> For GinTernaryValue, I think it's easier to just make it the same size >> as bool, since it doesn't go onto disk. My earlier patch did that. I'm >> not sure it's worth adding more code to copy the array around. > But on prairiedog the sizeof bool and c

Re: Why standby restores some WALs many times from archive?

2017-12-28 Thread Jeff Janes
On Thu, Dec 28, 2017 at 7:02 AM, Victor Yagofarov wrote: > Hi, > > I tried to ask a question in pgsql-general@ but got no response. > > I have postgres 9.4 standby with archive-based replication (via > restore_command). > Can you show us both your archive_command and your restore_command? Cheer

Re: The pg_indent on on ftp is outdated

2017-12-28 Thread Magnus Hagander
On Fri, Dec 22, 2017 at 1:33 AM, Craig Ringer wrote: > > > On 21 Dec. 2017 22:42, "Tom Lane" wrote: > > Magnus Hagander writes: > > On Thu, Dec 21, 2017 at 12:42 PM, Craig Ringer > > wrote: > >>> The pg_indent on www is outdated, and doesn't understand --version . > >>> https://www.postgresql.

Re: AS OF queries

2017-12-28 Thread Konstantin Knizhnik
Attached please find new version of AS OF patch which allows to specify time travel period. Older versions outside this period may be reclaimed by autovacuum. This behavior is controlled by "time_travel_period" parameter. Zero value of this parameter disables time travel and postgres behaves in

Re: Basebackups reported as idle

2017-12-28 Thread Magnus Hagander
On Fri, Dec 22, 2017 at 2:31 AM, Michael Paquier wrote: > On Thu, Dec 21, 2017 at 02:46:15PM +0100, Magnus Hagander wrote: > > On Thu, Dec 21, 2017 at 1:38 AM, Michael Paquier < > michael.paqu...@gmail.com> > > wrote: > >> I think that the call to pgstat_report_activity in WalSndLoop() should > >

Re: AS OF queries

2017-12-28 Thread Peter Eisentraut
On 12/28/17 11:36, Konstantin Knizhnik wrote: > Attached please find new version of AS OF patch which allows to specify > time travel period. > Older versions outside this period may be reclaimed by autovacuum. > This behavior is controlled by "time_travel_period" parameter. So where are we on us

Re: plpgsql function startup-time improvements

2017-12-28 Thread Tels
Hello Tom, On Wed, December 27, 2017 3:38 pm, Tom Lane wrote: > Attached are patches for two performance-improvement ideas that came > to me while working on [snip] > > Also, I changed PLpgSQL_var.isconst and PLpgSQL_var.notnull from "int" > to "bool", which is what they should have been all along

Re: [HACKERS] taking stdbool.h into use

2017-12-28 Thread Peter Eisentraut
Here is a new patch set that picks up the best pieces of the recent discussions: We use stdbool.h if available, use bool8 in the system catalogs, define GinTernaryValue to be the same size as bool, and rewrite the GinNullCategory code to work without casting. -- Peter Eisentraut htt

Re: pg_(total_)relation_size and partitioned tables

2017-12-28 Thread Peter Eisentraut
On 12/18/17 00:17, Amit Langote wrote: > I agree with the Robert's point which both David and Michael seem to agree > with that we shouldn't really be changing what pg_relation_size() is doing > under the covers. And I guess the same for pg_table_size(), too. Both of > those functions and their s

Re: [HACKERS] replace GrantObjectType with ObjectType

2017-12-28 Thread Stephen Frost
Peter, * Peter Eisentraut (peter.eisentr...@2ndquadrant.com) wrote: > On 12/20/17 22:01, Stephen Frost wrote: > > There's some downsides to this approach though: we do an initial set of > > checks in ExecGrantStmt, but we can't do all of them because we don't > > know if it's a sequence or not, so

Re: [HACKERS] replace GrantObjectType with ObjectType

2017-12-28 Thread Stephen Frost
Michael, * Michael Paquier (michael.paqu...@gmail.com) wrote: > On Tue, Dec 26, 2017 at 02:15:18PM -0500, Peter Eisentraut wrote: > > On 12/20/17 22:01, Stephen Frost wrote: > > > There's some downsides to this approach though: we do an initial set of > > > checks in ExecGrantStmt, but we can't do

Re: pg_(total_)relation_size and partitioned tables

2017-12-28 Thread David Rowley
On 29 December 2017 at 08:03, Peter Eisentraut wrote: > Here is another idea. If we had a function > > pg_partition_root(regclass) returns regclass > > (returning itself for non-partitioned relations), then users can easily > construct queries to get the results they want in different shapes, e.g

Re: [HACKERS] Proposal: Local indexes for partitioned table

2017-12-28 Thread Alvaro Herrera
Amit Langote wrote: > 2. Something strange about how dependencies are managed: > > create table p (a char) partition by list (a); > create table pa partition of p for values in ('a');; > create table pb partition of p for values in ('b'); > create index on p (a); > drop table pa; > ERROR: canno

Re: [HACKERS] pgbench more operators & functions

2017-12-28 Thread Fabien COELHO
Investigating your patch I found that all arguments of logical AND/OR and CASE are always evaluated. Seems, it should not be for pair of reasons: [...] SQL doesn't evaluate unneeded arguments: Here is a version with some lazy evaluation for and, or & case. -- Fabien.diff --git a/doc/src/sg

Re: Re: PATCH: Configurable file mode mask

2017-12-28 Thread David Steele
On 3/21/17 2:02 PM, David Steele wrote: On 3/18/17 3:57 PM, Robert Haas wrote: I think Tom's concerns about people doing insecure stuff are excessive.  People can do insecure stuff no matter what we do, and trying to prevent them often leads to them doing even-more-insecure stuff.  That having

Re: plpgsql function startup-time improvements

2017-12-28 Thread Tom Lane
"Tels" writes: > On Wed, December 27, 2017 3:38 pm, Tom Lane wrote: >> Also, I changed PLpgSQL_var.isconst and PLpgSQL_var.notnull from "int" >> to "bool", which is what they should have been all along, and relocated >> them in the PLpgSQL_var struct. > With a short test program printing out the

Re: Condition variable live lock

2017-12-28 Thread Thomas Munro
On Fri, Dec 22, 2017 at 4:46 PM, Thomas Munro wrote: > while (ConditionVariableSignal(cv)) > ++nwoken; > > The problem is that another backend can be woken up, determine that it > would like to wait for the condition variable again, and then get > itself added to the back o

Re: The pg_indent on on ftp is outdated

2017-12-28 Thread Craig Ringer
On 28 December 2017 at 23:59, Magnus Hagander wrote: > > > On Fri, Dec 22, 2017 at 1:33 AM, Craig Ringer > wrote: > >> >> >> On 21 Dec. 2017 22:42, "Tom Lane" wrote: >> >> Magnus Hagander writes: >> > On Thu, Dec 21, 2017 at 12:42 PM, Craig Ringer >> > wrote: >> >>> The pg_indent on www is ou

Re: Contributing with code

2017-12-28 Thread Craig Ringer
On 28 December 2017 at 23:05, Peter Eisentraut < peter.eisentr...@2ndquadrant.com> wrote: > On 12/27/17 15:18, Antonio Belloni wrote: > > I checked the code of pg_tablespace_databases, defined in > > src/backend/utils/adt/misc.c, and see that it uses a much simpler > > approach : It just reads the

Re: TAP test module - PostgresClient

2017-12-28 Thread Craig Ringer
On 28 December 2017 at 16:31, Kyotaro HORIGUCHI < horiguchi.kyot...@lab.ntt.co.jp> wrote: > Hello. > > It would be useful if we have interactive sessions for TAP > tests. My first attempt was apparently unstable one that was > using psql. > > https://www.postgresql.org/message-id/20170720.152533.

Re: TAP test module - PostgresClient

2017-12-28 Thread Tom Lane
Craig Ringer writes: > Another option might be to teach the TAP infrastructure and the buildfarm > client how to fetch cpanminus and build DBD::Pg against our build-tree, so > we could use Perl DBI. As a buildfarm owner, I'd take a *really* dim view of the buildfarm trying to auto-fetch code off

Re: [HACKERS] path toward faster partition pruning

2017-12-28 Thread David Rowley
On 28 December 2017 at 15:07, David Rowley wrote: > 43. In partition_prune.sql you have a mix of /* */ and -- comments. > Please just use -- Just a few extras that I found: 44. In match_clauses_to_partkey you're making use of estimate_expression_value(), I don't think this is safe. if (IsA(esti