A Generic Question about Generic type subscripting

2018-01-28 Thread Hannu Krosing
Sorry for being late to the party I started looking at the thread about "Generic type subscripting" and am wondering, why does it take the approach of modifying pg_type and modifying lots of internal functions, when instead it could be defined in a much lighter and less intrusive way as an

Re: unique indexes on partitioned tables

2018-01-28 Thread Amit Langote
Hi Alvaro. On 2018/01/23 7:55, Alvaro Herrera wrote: > Alvaro Herrera wrote: >> Version 4 of this patch, rebased on today's master. With the latest patch, I noticed what I think is an unintended behavior. create table p (a int, b int) partition by list (a); create table p1 partition of p for

Re: Query related to alter table ... attach partition

2018-01-28 Thread Ashutosh Bapat
On Tue, Jan 23, 2018 at 12:25 PM, Ashutosh Sharma wrote: >> > > That's right. But, shouldn't a partition that not at all fall in the > partition range be rejected when user tries to attach it. I feel we > should at least try throwing a WARNING message for it. Thoughts? >

Re: Logical Decoding and HeapTupleSatisfiesVacuum assumptions

2018-01-28 Thread Nikhil Sontakke
Hi, > Having this as responsibility of plugin sounds interesting. It certainly > narrows the scope for which we need to solve the abort issue. For 2PC > that may be okay as we need to somehow interact with transaction manager > as Simon noted. I am not sure if this helps streaming use-case though

Re: [HACKERS] [PATCH] Vacuum: Update FSM more frequently

2018-01-28 Thread Masahiko Sawada
On Sat, Jul 29, 2017 at 9:42 AM, Claudio Freire wrote: > Introduce a tree pruning threshold to FreeSpaceMapVacuum that avoids > recursing into branches that already contain enough free space, to > avoid having to traverse the whole FSM and thus induce quadratic > costs.

Re: JIT compiling with LLVM v9.0

2018-01-28 Thread Pierre Ducroquet
On Thursday, January 25, 2018 8:02:54 AM CET Andres Freund wrote: > Hi! > > On 2018-01-24 22:51:36 -0800, Jeff Davis wrote: > > Can we store the bitcode in pg_proc, simplifying deployment and > > allowing extensions to travel over replication? > > Yes, we could. You'd need to be a bit careful

RE: Temporary tables prevent autovacuum, leading to XID wraparound

2018-01-28 Thread Tsunakawa, Takayuki
From: Masahiko Sawada [mailto:sawada.m...@gmail.com] > What I thought is that a worker reports these two values after scanned > pg_class and after freezed a table. The launcher decides to launch a new > worker if the number of tables requiring anti-wraparound vacuum is greater > than the number of

Re: list partition constraint shape

2018-01-28 Thread Amit Langote
Fujita-san, On 2018/01/29 15:15, Etsuro Fujita wrote: > (2018/01/29 9:50), Amit Langote wrote: >> On 2018/01/26 21:31, Etsuro Fujita wrote: >>> Attached is a modified >>> version of the patch.  What do you think about that?  Please let me know. >>> If that is okay, I'll mark this as Ready for

Re: Reorder C includes in partition.c

2018-01-28 Thread Etsuro Fujita
(2018/01/28 13:06), Bruce Momjian wrote: Patch applied to head. Thank you! Best regards, Etsuro Fujita

Re: list partition constraint shape

2018-01-28 Thread Etsuro Fujita
(2018/01/29 9:50), Amit Langote wrote: On 2018/01/26 21:31, Etsuro Fujita wrote: Attached is a modified version of the patch. What do you think about that? Please let me know. If that is okay, I'll mark this as Ready for Committer. That looks good, thanks. Cool! One thing I noticed to

Re: Boolean partitions syntax

2018-01-28 Thread Tom Lane
Amit Langote writes: > Partition bound literals as captured gram.y don't have any type > information attached. Isn't that design broken by definition? TRUE is not the same thing as 't', nor as 'true'. Nor are 1 and '1' the same thing; it's true that in some

Re: CREATE ROUTINE MAPPING

2018-01-28 Thread Ashutosh Bapat
On Thu, Jan 25, 2018 at 10:43 AM, David Fetter wrote: > On Thu, Jan 18, 2018 at 04:09:13PM -0500, Corey Huinker wrote: >> > >> > >> > > >> > > But other situations seem un-handle-able to me: >> > > >> > > SELECT remote_func1(l.x) FROM local_table l WHERE l.active = true; >> > >>

Re: [HACKERS] [PATCH] Overestimated filter cost and its mitigation

2018-01-28 Thread Yuto Hayamizu
On Fri, Jan 19, 2018 at 5:07 PM, Yuto Hayamizu wrote: > My idea of improving this patch is that give a threshold N_limit, > and for q_1 ... q_N_limit, do the same weighted cost estimation in the > current version of this patch. > For q_{N_limit+1} , stop calling

Re: Linking PostgreSQL as a C++ program

2018-01-28 Thread Craig Ringer
On 29 January 2018 at 18:02, Michael Paquier wrote: > On Mon, Jan 29, 2018 at 05:46:54PM +1300, Craig Ringer wrote: > > extern "C" { > > #include "postgres.h" > > } > > Don't you need __cplusplus as well? More or less that: > > #ifdef __cplusplus > extern "C" { >

Re: Temporary tables prevent autovacuum, leading to XID wraparound

2018-01-28 Thread Masahiko Sawada
On Fri, Jan 26, 2018 at 2:22 PM, Tsunakawa, Takayuki wrote: > From: Masahiko Sawada [mailto:sawada.m...@gmail.com] >> On Thu, Jan 25, 2018 at 3:14 PM, Tsunakawa, Takayuki >> wrote: >> > * Why does autovacuum launcher always choose

Re: Linking PostgreSQL as a C++ program

2018-01-28 Thread Michael Paquier
On Mon, Jan 29, 2018 at 05:46:54PM +1300, Craig Ringer wrote: > extern "C" { > #include "postgres.h" > } Don't you need __cplusplus as well? More or less that: #ifdef __cplusplus extern "C" { #endif #include "postgres.h" #ifdef __cplusplus } #endif -- Michael signature.asc Description: PGP

Re: Failed test 'psql query died successfully after SIGQUIT'

2018-01-28 Thread Thomas Munro
On Mon, Jan 29, 2018 at 5:48 PM, Thomas Munro wrote: > On Mon, Jan 29, 2018 at 5:35 PM, Tom Lane wrote: >> Thomas Munro writes: >>> Does anyone have any thoughts on why Travis CI might be failing >>> occasionally

Re: Failed test 'psql query died successfully after SIGQUIT'

2018-01-28 Thread Thomas Munro
On Mon, Jan 29, 2018 at 5:35 PM, Tom Lane wrote: > Thomas Munro writes: >> Does anyone have any thoughts on why Travis CI might be failing >> occasionally as shown below, but the build farm apparently doesn't? >> It's not alien technology, it's

Linking PostgreSQL as a C++ program

2018-01-28 Thread Craig Ringer
Hi all In my ongoing efforts to make Tom look at me in horror, I've compiled PostgreSQL with C++ objects linked into the core server. Currently this is just my notes on how, in case anyone else needs to later. To do it you really only have to change src/backend/Makefile to use g++ as a linker:

Re: [HACKERS] GnuTLS support

2018-01-28 Thread Michael Paquier
On Sat, Jan 27, 2018 at 05:00:17PM -0500, Peter Eisentraut wrote: > On 1/25/18 09:07, Peter Eisentraut wrote: >> On 1/19/18 13:43, Peter Eisentraut wrote: >>> Comparing the existing {be,fe}-secure-openssl.c with the proposed >>> {be,fe}-secure-gnutls.c, and with half an eye on the previously

Re: Failed test 'psql query died successfully after SIGQUIT'

2018-01-28 Thread Tom Lane
Thomas Munro writes: > Does anyone have any thoughts on why Travis CI might be failing > occasionally as shown below, but the build farm apparently doesn't? > It's not alien technology, it's just Ubuntu Linux running on a virtual > machine. One thing that it does

Re: [HACKERS] Secondary index access optimizations

2018-01-28 Thread Thomas Munro
On Sat, Jan 20, 2018 at 5:41 AM, Konstantin Knizhnik wrote: > On 19.01.2018 16:14, Antonin Houska wrote: >> you should test the operator B-tree strategy: BTLessStrategyNumber, >> BTLessEqualStrategyNumber, etc. The operator string alone does not tell >> enough >> about

Re: Redefining inet_net_ntop

2018-01-28 Thread Craig Ringer
On 29 January 2018 at 17:07, Tom Lane wrote: > > Another choice would be to stick a pg_ prefix on the function name. > That, plus a comment, seems just fine to me. -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support,

Re: [HACKERS] WIP: Separate log file for extension

2018-01-28 Thread Jing Wang
Hi Antonin, 1. check-world run error as following: for extra in contrib/adminpack; do make -C '../..'/$extra DESTDIR='/db/pgmaster/postgres'/tmp_install install >>'/db/pgmaster/postgres'/tmp_install/log/install.log || exit; done In file included from ../../src/include/c.h:1135:0,

Re: Boolean partitions syntax

2018-01-28 Thread Amit Langote
On 2018/01/27 1:31, Tom Lane wrote: > Robert Haas writes: >> On Fri, Jan 26, 2018 at 11:07 AM, Stephen Frost wrote: >>> I've already had two people mention that it'd be neat to have PG support >>> it, so I don't believe it'd go unused. As for if we

Re: Redefining inet_net_ntop

2018-01-28 Thread Tom Lane
Craig Ringer writes: > On 27 January 2018 at 04:27, Tom Lane wrote: >> Almost certainly, the thing to do is absorb updated code from bind, >> not roll our own. > I asked because I didn't see any comments explaining why we had it and why > we built it

Re: [HACKERS] why not parallel seq scan for slow functions

2018-01-28 Thread Amit Kapila
On Sat, Jan 27, 2018 at 2:50 AM, Robert Haas wrote: > On Tue, Jan 2, 2018 at 6:38 AM, Amit Kapila wrote: >> [ new patch ] > > I think that grouping_planner() could benefit from a slightly more > extensive rearrangement. With your patch applied,

Re: Updating timezone data to 2018c

2018-01-28 Thread Michael Paquier
On Fri, Jan 26, 2018 at 10:21:33AM -0500, Tom Lane wrote: > Probably, at the time I checked the abbrevs list when I installed 2017b, > WAST was still being detected as a currently-in-use abbreviation. > Now it isn't. What I'll probably do is mark the abbreviation obsolete > but leave it in place

Re: [Sender Address Forgery]Re: pg_(total_)relation_size and partitioned tables

2018-01-28 Thread Michael Paquier
On Mon, Jan 29, 2018 at 10:08:51AM +0900, Amit Langote wrote: > On 2018/01/27 3:32, Robert Haas wrote: >> If it has >> either partitions or inheritance children, find_all_inheritors will >> return them. Otherwise, I think it'll just return the input OID >> itself. So I don't quite see, if we're

Re: Boolean partitions syntax

2018-01-28 Thread Amit Langote
On 2018/01/27 0:30, Robert Haas wrote: > On Thu, Jan 25, 2018 at 8:44 PM, Amit Langote > wrote: >> Attached updated patch. > > I wonder if this patch is just parser bloat without any real benefit. > It can't be very common to want to partition on a Boolean column,

Re: Invalid result from hash_page_items function

2018-01-28 Thread Masahiko Sawada
On Sat, Jan 27, 2018 at 12:04 AM, Robert Haas wrote: > On Thu, Jan 25, 2018 at 4:50 PM, Masahiko Sawada > wrote: >> This appears at PostgreSQL 10 and current HEAD. The cause of this >> seems that hash_page_items allocates the memory space for the

Re: Redefining inet_net_ntop

2018-01-28 Thread Craig Ringer
On 27 January 2018 at 04:27, Tom Lane wrote: > Emre Hasegeli writes: > >> port.h declares inet_net_ntop and we always compile our own from > >> port/inet_net_ntop.c . > > > There is another copy of it under backend/utils/adt/inet_cidr_ntop.c. > > The code

Re: [Sender Address Forgery]Re: pg_(total_)relation_size and partitioned tables

2018-01-28 Thread Amit Langote
On 2018/01/27 3:32, Robert Haas wrote: > On Fri, Jan 26, 2018 at 7:45 AM, Michael Paquier > wrote: >> There could be value in having a version dedicated to inheritance trees >> as well, true enough. As well as value in having something that shows >> both. Still let's

Re: list partition constraint shape

2018-01-28 Thread Amit Langote
Fujita-san, On 2018/01/26 21:31, Etsuro Fujita wrote: > (2018/01/26 10:15), Amit Langote wrote: >> On 2018/01/25 21:17, Etsuro Fujita wrote: >>> Some minor comments: >>> >>> +   /* >>> +    * Construct an ArrayExpr for the non-null partition >>> +   

Re: Built-in connection pooling

2018-01-28 Thread Bruce Momjian
On Sun, Jan 28, 2018 at 03:11:25PM -0800, Ivan Novick wrote: > > The simplest thing sounds like a GUC that will automitcally end a connection > > > idle for X seconds. > > Uh, we already have idle_in_transaction_session_timeout so we would just > need a simpler version. > > > Oh i

Re: proposal: alternative psql commands quit and exit

2018-01-28 Thread Bruce Momjian
On Thu, Jan 25, 2018 at 03:46:30PM -0500, Bruce Momjian wrote: > On Mon, Jan 15, 2018 at 11:10:44AM -0500, Robert Haas wrote: > > prompt_status does seem to be available in psql's MainLoop(), so I > > think that could be done, but the problem is that I don't know exactly > > what message would be

Re: Built-in connection pooling

2018-01-28 Thread Ivan Novick
> The simplest thing sounds like a GUC that will automitcally end a connection > > idle for X seconds. > > Uh, we already have idle_in_transaction_session_timeout so we would just > need a simpler version. > Oh i see its in 9.6, AWESOME! Cheers

Re: Documentation of pgcrypto AES key sizes

2018-01-28 Thread Thomas Munro
On Sat, Jan 27, 2018 at 4:56 AM, Robert Haas wrote: > On Thu, Jan 25, 2018 at 8:19 PM, Michael Paquier > wrote: >> On Fri, Jan 26, 2018 at 12:33:41PM +1300, Thomas Munro wrote: >>> I noticed that the documentation for encrypt()/decrypt() says

Re: Write lifetime hints for NVMe

2018-01-28 Thread Dmitry Dolgov
> On 27 January 2018 at 23:53, Tomas Vondra > wrote: > > Amazon actually does provide instance types (f1 and i3) with real NVMe > devices. That's what I'd be testing. Yes, indeed, that's a better target for testing, thanks. I'll write back when will get some

Re: JIT compiling with LLVM v9.0

2018-01-28 Thread Pierre Ducroquet
On Thursday, January 25, 2018 8:12:42 PM CET Andres Freund wrote: > Hi, > > On 2018-01-25 10:00:14 +0100, Pierre Ducroquet wrote: > > I don't know when this would be released, > > August-October range. > > > but the minimal supported LLVM > > version will have a strong influence on the

Re: Built-in connection pooling

2018-01-28 Thread Ivan Novick
On Sat, Jan 27, 2018 at 4:40 PM, Bruce Momjian wrote: > On Mon, Jan 22, 2018 at 06:51:08PM +0100, Tomas Vondra wrote: > Right now, if you hit max_connections, we start rejecting new > connections. Would it make sense to allow an option to exit idle > connections when this

Re: Transform for pl/perl

2018-01-28 Thread Thomas Munro
On Fri, Jan 12, 2018 at 9:47 PM, Anthony Bykov wrote: > On Fri, 12 Jan 2018 15:19:26 +1300 > Thomas Munro wrote: > Hello, thank you for your message. > The problem was that different perl compilers uses different infinity > representations.

Failed test 'psql query died successfully after SIGQUIT'

2018-01-28 Thread Thomas Munro
Hi, Does anyone have any thoughts on why Travis CI might be failing occasionally as shown below, but the build farm apparently doesn't? It's not alien technology, it's just Ubuntu Linux running on a virtual machine. One thing that it does slightly differently is "make -Otarget -j3 check-world"

Failed test 'pg_recvlogical acknowledged changes, nothing pending on slot'

2018-01-28 Thread Thomas Munro
Hello, I saw a one-off test failure that might be trying to tell us something: https://travis-ci.org/postgresql-cfbot/postgresql/builds/334334417 # Failed test 'pg_recvlogical acknowledged changes, nothing pending on slot' # at t/006_logical_decoding.pl line 91. # got: 'BEGIN #

Re: [PATCH] Logical decoding of TRUNCATE

2018-01-28 Thread Petr Jelinek
On 26/01/18 03:44, Peter Eisentraut wrote: > On 1/24/18 07:53, Petr Jelinek wrote: >> That depends on if we consider this to be part of sequence handling or >> truncate statement replication handling. It's true that if we had >> sequence replication, the restart would get propagated that way

Re: Best way to select a random row from a derived table

2018-01-28 Thread Condor
On 28-01-2018 08:39, Ryan Murphy wrote: Hello hackers and postgressers, I am aware of 2 ways to select a random row from a table: 1) select * from table_name order by random() limit 1; -- terribly inefficient 2) select * from table_name tablesample system_rows(1) limit 1;

Re: Best way to select a random row from a derived table

2018-01-28 Thread Fabien COELHO
I am aware of 2 ways to select a random row from a table: 1) select * from table_name order by random() limit 1; -- terribly inefficient 2) select * from table_name tablesample system_rows(1) limit 1; -- only works on tables, not views or subqueries Is there an option

Re: General purpose hashing func in pgbench

2018-01-28 Thread Fabien COELHO
Hello Ildar, I did everything you mention here and attached a new version on the patch. Patch applies, compiles, runs ok. Alas, I still have a few more very minor comments about the doc, sorry again: +default_seed + random seed used in hash functions by default