Re: Ordering of header file inclusion

2019-10-19 Thread Tom Lane
Andres Freund writes: > On 2019-10-19 21:50:03 +0200, Peter Eisentraut wrote: >> This class of change I don't like. >> The existing arrangement keeps "other" header files separate from the >> header file of the module itself. It seems useful to keep that separate. > If we were to do so, we ought

Re: Add a GUC variable that control logical replication

2019-10-19 Thread Euler Taveira
Em sáb, 19 de out de 2019 às 14:11, Peter Eisentraut escreveu: > > On 2019-09-18 11:33, Quan Zongliang wrote: > > On 2019/9/18 17:11, Peter Eisentraut wrote: > >> Why do you need to turn off replication when there is "maintenance" on a > >> table? What does that even mean? > >> > > In a table, th

Re: Ordering of header file inclusion

2019-10-19 Thread Andres Freund
Hi, On 2019-10-19 21:50:03 +0200, Peter Eisentraut wrote: > diff --git a/contrib/bloom/blcost.c b/contrib/bloom/blcost.c > index f9fe57f..6224735 100644 > --- a/contrib/bloom/blcost.c > +++ b/contrib/bloom/blcost.c > @@ -12,10 +12,10 @@ > */ > #include "postgres.h" > > +#include "bloom.h" > #

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Nikolay Samokhvalov
On Sat, Oct 19, 2019 at 8:11 AM Isaac Morland wrote: > That embeds a temporary hack in the application code indefinitely. > Or postpone the migration indefinitely. I saw so many times how migration in large companies was postponed because of similar "small" issues -- when the code base is large,

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Nikolay Samokhvalov
+1 for the configuration option. Otherwise, migration is a nightmare -- so many CTEs were written specifically to use the "optimization fence" behavior. The lack of such configuration options is now a "migration fence". On Sat, Oct 19, 2019 at 2:49 AM Colin Watson wrote: > On Sat, Oct 19, 2019 a

Re: dropdb --force

2019-10-19 Thread Pavel Stehule
so 19. 10. 2019 v 12:37 odesílatel Amit Kapila napsal: > On Fri, Oct 4, 2019 at 9:54 PM Pavel Stehule > wrote: > > > >> > >> Can we add few tests for this feature. > > > > there are not any other test for DROP DATABASE > > > > I think there are no dedicated tests for it but in a few tests, we us

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Tom Lane
Tomas Vondra writes: > +0.5 > In general, I'm not opposed to accepting and ignoring the MATERIALIZED > syntax (assuming we'd only accept AS MATERIALIZED, but not the negative > variant). FWIW, I'm +0.1 or thereabouts. I'd vote -1 if the patch required introducing a new lexer keyword (even an un

Re: Ordering of header file inclusion

2019-10-19 Thread Peter Eisentraut
diff --git a/contrib/bloom/blcost.c b/contrib/bloom/blcost.c index f9fe57f..6224735 100644 --- a/contrib/bloom/blcost.c +++ b/contrib/bloom/blcost.c @@ -12,10 +12,10 @@ */ #include "postgres.h" +#include "bloom.h" #include "fmgr.h" #include "utils/selfuncs.h" -#include "bloom.h" /* * Est

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread Ariadne Conill
Hello, On Sat, Oct 19, 2019, 3:27 PM Tomas Vondra wrote: > On Sat, Oct 19, 2019 at 12:47:39PM -0400, Andrew Dunstan wrote: > > > >On 10/19/19 12:32 PM, David G. Johnston wrote: > >> On Sat, Oct 19, 2019 at 9:19 AM Tomas Vondra > >> mailto:tomas.von...@2ndquadrant.com>> > >> wrote: > >> > >>

Re: pause recovery if pitr target not reached

2019-10-19 Thread Peter Eisentraut
On 2019-09-17 13:23, Leif Gunnar Erlandsen wrote: > This patch allows PostgreSQL to pause recovery before PITR target is reached > if recovery_target_time is specified. > > Missing WAL's could then be restored from backup and applied on next restart. > > Today PostgreSQL opens the database in re

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread Tomas Vondra
On Sat, Oct 19, 2019 at 12:47:39PM -0400, Andrew Dunstan wrote: On 10/19/19 12:32 PM, David G. Johnston wrote: On Sat, Oct 19, 2019 at 9:19 AM Tomas Vondra mailto:tomas.von...@2ndquadrant.com>> wrote: > >We invented jsonb_set() (credit to Dmitry Dolgov). And we've had it >since 9.5

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Isaac Morland
On Sat, 19 Oct 2019 at 13:36, Stephen Frost wrote: > Greetings, > > * Isaac Morland (isaac.morl...@gmail.com) wrote: > > That embeds a temporary hack in the application code indefinitely. > > ... one could argue the same about having to say AS MATERIALIZED. > I think OFFSET 0 is a hack - the fac

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Stephen Frost
Greetings, * Isaac Morland (isaac.morl...@gmail.com) wrote: > That embeds a temporary hack in the application code indefinitely. ... one could argue the same about having to say AS MATERIALIZED. Thanks, Stephen signature.asc Description: PGP signature

Re: Add a GUC variable that control logical replication

2019-10-19 Thread Peter Eisentraut
On 2019-09-18 11:33, Quan Zongliang wrote: > On 2019/9/18 17:11, Peter Eisentraut wrote: >> Why do you need to turn off replication when there is "maintenance" on a >> table? What does that even mean? >> > In a table, the user only keep data for a period of time and delete > expired records every

Re: Fix most -Wundef warnings

2019-10-19 Thread Peter Eisentraut
On 2019-10-14 17:12, Mark Dilger wrote: > The check on HSTORE_IS_HSTORE_NEW goes back at least as far as 2006, > suggesting it was needed for migrating from some version pre-9.0, making > me wonder if anybody would need this in the field. Should we drop > support for this? I don't have a stron

Re: Fix most -Wundef warnings

2019-10-19 Thread Peter Eisentraut
On 2019-10-13 21:25, Peter Eisentraut wrote: > During the cleanup of the _MSC_VER versions (commit > 38d8dce61fff09daae0edb6bcdd42b0c7f10ebcd), I found it useful to use > -Wundef, but that resulted in a bunch of gratuitous warnings. Here is a > patch to fix those. Most of these are just stylistic

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread Andrew Dunstan
On 10/19/19 12:32 PM, David G. Johnston wrote: > On Sat, Oct 19, 2019 at 9:19 AM Tomas Vondra > mailto:tomas.von...@2ndquadrant.com>> > wrote: > > > > >We invented jsonb_set() (credit to Dmitry Dolgov). And we've had it > >since 9.5. That's five releases ago.  So it's a bit late to be

Re: pgsql: Implement jsonpath .datetime() method

2019-10-19 Thread Alexander Korotkov
On Mon, Oct 14, 2019 at 5:36 AM Alexander Korotkov wrote: > On Sun, Oct 13, 2019 at 5:24 AM Tom Lane wrote: > > Alexander Korotkov writes: > > > This patch also changes the way timestamp to timestamptz cast works. > > > Previously it did timestamp2tm() then tm2timestamp(). Instead, after > > >

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread David G. Johnston
On Sat, Oct 19, 2019 at 9:19 AM Tomas Vondra wrote: > > > >We invented jsonb_set() (credit to Dmitry Dolgov). And we've had it > >since 9.5. That's five releases ago. So it's a bit late to be coming to > >us telling us it's not safe (according to your preconceptions of what it > >should be doing

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread Andrew Dunstan
On 10/19/19 12:18 PM, Tomas Vondra wrote: > On Sat, Oct 19, 2019 at 11:26:50AM -0400, Andrew Dunstan wrote: > > Not sure, but that seems rather confusing to me, because it's mixing SQL > NULL and JSON null, i.e. it's not clear to me why > >    jsonb_set(..., "...", NULL) > > should do the same th

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread Tomas Vondra
On Sat, Oct 19, 2019 at 11:26:50AM -0400, Andrew Dunstan wrote: ... The hyperbole here is misplaced. There is a difference between a bug and a POLA violation. This might be the latter, but it isn't the former. So please tone it down a bit. It's not the function that's unsafe, but the ill-inform

Re: configure fails for perl check on CentOS8

2019-10-19 Thread Andrew Dunstan
On 10/18/19 9:50 AM, Tom Lane wrote: > Kyotaro Horiguchi writes: >> The immediately problematic command generated by autoconf is: >> ... >> /usr/bin/ld: /tmp/ccGxodNv.o: relocation R_X86_64_32 against symbol >> `PL_memory_wrap' can not be used when making a PIE object; recompile with >> -fPIC

Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays

2019-10-19 Thread Stephen Frost
Greetings, * Andres Freund (and...@anarazel.de) wrote: > On 2019-10-18 09:03:31 -0400, Stephen Frost wrote: > > * Chapman Flack (c...@anastigmatix.net) wrote: > > > On 10/18/19 08:18, Stephen Frost wrote: > > > > I realize that I need to don some fireproof gear for suggesting this, > > > > but I r

Re: SQL/JSON: JSON_TABLE

2019-10-19 Thread Pavel Stehule
Hi po 30. 9. 2019 v 18:09 odesílatel Pavel Stehule napsal: > Hi > > so 28. 9. 2019 v 3:53 odesílatel Nikita Glukhov > napsal: > >> Attached 39th version of the patches rebased onto current master. >> >> This patch is still pretty big - it is about 6000 lines (without any documentation). I chec

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Andrew Dunstan
On 10/19/19 11:10 AM, Isaac Morland wrote: > On Sat, 19 Oct 2019 at 10:53, Andrew Dunstan > > wrote: > > > > In general, I'm not opposed to accepting and ignoring the > MATERIALIZED > > syntax (assuming we'd only accept AS MATERIALIZED, but not

Re: jsonb_set() strictness considered harmful to data

2019-10-19 Thread Andrew Dunstan
On 10/18/19 3:10 PM, Mark Felder wrote: > > On Fri, Oct 18, 2019, at 12:37, Ariadne Conill wrote: >> Hello, >> >> I am one of the primary maintainers of Pleroma, a federated social >> networking application written in Elixir, which uses PostgreSQL in >> ways that may be considered outside the typ

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Isaac Morland
On Sat, 19 Oct 2019 at 10:53, Andrew Dunstan wrote: > > > In general, I'm not opposed to accepting and ignoring the MATERIALIZED > > syntax (assuming we'd only accept AS MATERIALIZED, but not the negative > > variant). > > > > FWIW I'm not sure the "we don't want to upgrade application code at th

Log statement sample - take two

2019-10-19 Thread Adrien Nayrat
Hello, This patch propose a new way to sample statement to logs. As a reminder, this feature was committed in PG12[1] then reverted[2] after the proposition of log_statement_sample_limit[3] The first implementation added a new GUC to sample statement logged by log_min_duration_statement. Then, w

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Andrew Dunstan
On 10/19/19 6:48 AM, Tomas Vondra wrote: > On Sat, Oct 19, 2019 at 11:56:56AM +0200, Andres Freund wrote: >> Hi, >> >> On October 19, 2019 6:01:04 AM GMT+02:00, Andrew Gierth >> wrote: "Michael" == Michael Paquier writes: >>> >>> > On Fri, Oct 18, 2019 at 02:21:30PM +0100, Colin Watson

Remove obsolete options for createuser

2019-10-19 Thread Alexander Lakhin
Hello hackers, I've noticed that the createuser utility supports two undocumented options (--adduser, --no-adduser), that became obsolete in 2005. I believe that their existence should come to end someday (maybe today?). The patch to remove them is attached. Best regards. Alexander diff --git a/

Re: Compressed pluggable storage experiments

2019-10-19 Thread Tomas Vondra
On Fri, Oct 18, 2019 at 03:25:05AM -0700, Andres Freund wrote: Hi, On 2019-10-17 12:47:47 -0300, Alvaro Herrera wrote: On 2019-Oct-10, Ildar Musin wrote: > 1. Unlike FDW API, in pluggable storage API there are no routines like > "begin modify table" and "end modify table" and there is no share

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Tomas Vondra
On Sat, Oct 19, 2019 at 10:22:39AM +0100, Colin Watson wrote: On Sat, Oct 19, 2019 at 05:01:04AM +0100, Andrew Gierth wrote: > "Michael" == Michael Paquier writes: > On Fri, Oct 18, 2019 at 02:21:30PM +0100, Colin Watson wrote: >> However, an alternative would be to backport the new synta

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Tomas Vondra
On Sat, Oct 19, 2019 at 11:56:56AM +0200, Andres Freund wrote: Hi, On October 19, 2019 6:01:04 AM GMT+02:00, Andrew Gierth wrote: "Michael" == Michael Paquier writes: > On Fri, Oct 18, 2019 at 02:21:30PM +0100, Colin Watson wrote: >> However, an alternative would be to backport the new syn

Re: dropdb --force

2019-10-19 Thread Amit Kapila
On Fri, Oct 4, 2019 at 9:54 PM Pavel Stehule wrote: > >> >> Can we add few tests for this feature. > > there are not any other test for DROP DATABASE > I think there are no dedicated tests for it but in a few tests, we use it like in contrib\sepgsql\sql\alter.sql. I am not sure if we can write a

Re: Proposal: Make use of C99 designated initialisers for nulls/values arrays

2019-10-19 Thread Andres Freund
Hi, On 2019-10-18 09:03:31 -0400, Stephen Frost wrote: > * Chapman Flack (c...@anastigmatix.net) wrote: > > On 10/18/19 08:18, Stephen Frost wrote: > > > I realize that I need to don some fireproof gear for suggesting this, > > > but I really wonder how much fallout we'd have from just allowing {}

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Andres Freund
Hi, On October 19, 2019 6:01:04 AM GMT+02:00, Andrew Gierth wrote: >> "Michael" == Michael Paquier writes: > > > On Fri, Oct 18, 2019 at 02:21:30PM +0100, Colin Watson wrote: > >> However, an alternative would be to backport the new syntax to some > >> earlier versions. "WITH ... AS MATERI

Re: Backport "WITH ... AS MATERIALIZED" syntax to <12?

2019-10-19 Thread Colin Watson
On Sat, Oct 19, 2019 at 05:01:04AM +0100, Andrew Gierth wrote: > > "Michael" == Michael Paquier writes: > > On Fri, Oct 18, 2019 at 02:21:30PM +0100, Colin Watson wrote: > >> However, an alternative would be to backport the new syntax to some > >> earlier versions. "WITH ... AS MATERIALIZED

Fix of fake unlogged LSN initialization

2019-10-19 Thread tsunakawa.ta...@fujitsu.com
Hello, The attached trivial patch fixes the initialization of the fake unlogged LSN. Currently, BootstrapXLOG() in initdb sets the initial fake unlogged LSN to FirstNormalUnloggedLSN (=1000), but the recovery and pg_resetwal sets it to 1. The patch modifies the latter two cases to match init

Re: Obsolete comment in partbounds.c

2019-10-19 Thread Etsuro Fujita
Hi Alvaro, On Fri, Oct 18, 2019 at 6:56 PM Alvaro Herrera wrote: > On 2019-Oct-18, Etsuro Fujita wrote: > > While reviewing the partitionwise-join patch, I noticed $Subject,ie, > > this in create_list_bounds(): > > > > /* > > * Never put a null into the values arr