Using old master as new replica after clean switchover

2018-10-24 Thread Nikolay Samokhvalov
Currently, the documentation explicitly states, that after failover, the old master must be recreated from scratch, or pg_rewind should be used (requiring wal_log_hints to be on, which is off by default): > The former standby is now the primary, but the former primary is down and might stay down.

Re: pgbench - add pseudo-random permutation function

2018-10-24 Thread Fabien COELHO
Hello Alvaro, although not comment changes which break the logic of the algorithm descriptions. I have not found how to tell pgindent to let comments indentation alone. You can use /*- for such comments. Thanks for the hint. Here is an updated patch using this marker. I noticed that so

Re: [Todo item] Add entry creation timestamp column to pg_stat_replication

2018-10-24 Thread Laurenz Albe
MyungKyu LIM wrote: > I have worked on following todo list item. > > - Add entry creation timestamp column to pg_stat_replication > http://archives.postgresql.org/pgsql-hackers/2011-08/msg00694.php > > This item looks like simple because necessary data was already exist. > So, I wrote a p

Re: pg_stat_replication vs StandbyReplyMessage

2018-10-24 Thread Laurenz Albe
MyungKyu LIM wrote: > I saw this topic in todo list, > > so I implemented simple patch. > > https://www.postgresql.org/message-id/flat/1657809367.407321.1533027417725.JavaMail.jboss%40ep2ml404 For the archives' sake, please always reply on the original thread. Yours, Laurenz Albe

Re: pg_stat_replication vs StandbyReplyMessage

2018-10-24 Thread MyungKyu LIM
Hello hackers, Still need to solve this topic? https://www.postgresql.org/message-id/flat/CABUevEwA%3DAFWXr-7cCpZ9MDdxHL2wFGsxFiB6uyFDTOhRudGrA%40mail.gmail.com I saw this topic in todo list, so I implemented simple patch. https://www.postgresql.org/message-id/flat/1657809367.407321.1533027417

RE: Timeout parameters

2018-10-24 Thread Nagaura, Ryohei
Hi Andrei, Thank you for response. > TCP_USER_TIMEOUT option helps to overcome this problem and I agree with > you that it needs to be supported within PostgreSQL. I'm glad to your agreement. > Nevertheless, it is necessary to take into account that the option > TCP_USER_TIMEOUT is supported by

Re: A small tweak to some comments for PartitionKeyData

2018-10-24 Thread Amit Langote
On 2018/10/25 13:13, David Rowley wrote: > On 25 October 2018 at 17:05, Amit Langote > wrote: >> On 2018/10/25 12:54, David Rowley wrote: >>> On 25 October 2018 at 16:46, Amit Langote >>> wrote: +* key, one for each zero

Re: A small tweak to some comments for PartitionKeyData

2018-10-24 Thread David Rowley
On 25 October 2018 at 17:05, Amit Langote wrote: > On 2018/10/25 12:54, David Rowley wrote: >> On 25 October 2018 at 16:46, Amit Langote >> wrote: >>> +* key, one >>> for each zero-valued partattrs */ >>> >>> How about: for each ze

Re: A small tweak to some comments for PartitionKeyData

2018-10-24 Thread Amit Langote
On 2018/10/25 12:54, David Rowley wrote: > On 25 October 2018 at 16:46, Amit Langote > wrote: >> +* key, one >> for each zero-valued partattrs */ >> >> How about: for each zero-valued member of partattrs? > > Aren't arrays made up

Re: A small tweak to some comments for PartitionKeyData

2018-10-24 Thread David Rowley
On 25 October 2018 at 16:46, Amit Langote wrote: > +* key, one > for each zero-valued partattrs */ > > How about: for each zero-valued member of partattrs? Aren't arrays made up of elements? I did have "element" on the end, but I

Re: A small tweak to some comments for PartitionKeyData

2018-10-24 Thread Amit Langote
On 2018/10/25 12:43, David Rowley wrote: > While doing a bit of work on a partitioning patch I noticed that it's > not really that obvious that there's meant to be exactly 1 item in the > partexprs List for each zero-valued partattrs element. Some incorrect > code using these fields was the cause o

A small tweak to some comments for PartitionKeyData

2018-10-24 Thread David Rowley
While doing a bit of work on a partitioning patch I noticed that it's not really that obvious that there's meant to be exactly 1 item in the partexprs List for each zero-valued partattrs element. Some incorrect code using these fields was the cause of CVE-2018-1052, so I think it's worthwhile to me

Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER

2018-10-24 Thread Michael Paquier
On Wed, Oct 24, 2018 at 10:36:41AM +0100, Dagfinn Ilmari Mannsåker wrote: > Fair point. I was unsure about whether to complete every supported > variant or just the new one. Updated patches attached. One problem with this approach is that a user needs to use twice tab. The first time is to show "

Re: Re: Question about xmloption and pg_restore

2018-10-24 Thread Chapman Flack
On 05/18/18 15:50, Robert Haas wrote: > On Thu, May 17, 2018 at 9:37 AM, Stefan Fercot > wrote: >> ERROR: invalid XML content >> DETAIL: line 1: StartTag: invalid element name >> http://mrcc.com/qgis.dtd' 'SYSTEM'> >> ^ >> CONTEXT: COPY layer_styles, line 1, column styleqml: "> 'http://mrcc.c

PostgreSQL vs SQL/XML Standards

2018-10-24 Thread Chapman Flack
Inspired by the wiki page on PostgreSQL vs SQL Standard in general, I have made another wiki page specifically about $subject. I hope this was not presumptuous, and invite review / comment. I have not linked to it from any other page yet. https://wiki.postgresql.org/wiki/PostgreSQL_vs_SQL/XML_Stan

Re: pg_logdir_ls function throwing an error if log_filename name is not default

2018-10-24 Thread Michael Paquier
On Wed, Oct 24, 2018 at 08:26:28PM +0530, tushar wrote: > Is this an expected , if so - any work around ? That's part of the way pg_logdir_ls_internal() is designed in adminpack I am afraid as the function internally parses the timestamp from each file name. -- Michael signature.asc Description:

Re: Multiple Wait Events for extensions

2018-10-24 Thread Michael Paquier
On Wed, Oct 24, 2018 at 11:18:13AM -0700, legrand legrand wrote: > Would a hard coded solution as described here after possible for > mid-term? I don't think I would commit that as we would want a better solution with custom names, but patching Postgres to do so with a custom build would be easy e

Re: Side effect of CVE-2017-7484 fix?

2018-10-24 Thread Tom Lane
Robert Haas writes: > On Mon, Oct 22, 2018 at 9:47 AM Tom Lane wrote: >> This was complained of already, >> https://www.postgresql.org/message-id/flat/3876.1531261875%40sss.pgh.pa.us > I guess you never followed up on that part, though. Any special > reason for that, or just lack of round tuits

Re: pgbench - add pseudo-random permutation function

2018-10-24 Thread Michael Paquier
On Wed, Oct 24, 2018 at 06:00:08PM -0300, Alvaro Herrera wrote: > On 2018-Oct-24, Fabien COELHO wrote: >> although not comment changes which break the logic of the algorithm >> descriptions. I have not found how to tell pgindent to let comments >> indentation alone. > > You can use /*- for such

Re: Log timestamps at higher resolution

2018-10-24 Thread Michael Paquier
On Thu, Oct 25, 2018 at 01:00:08PM +1300, David Rowley wrote: > On 25 October 2018 at 11:25, David Fetter wrote: >> Strangely, there were no tests that came with that either. David, did >> you mean to expand it past space padding, or...? > > Unsure what infrastructure existed then for testing th

Re: Function to promote standby servers

2018-10-24 Thread Michael Paquier
On Wed, Oct 24, 2018 at 08:50:43AM +0900, Michael Paquier wrote: > On Tue, Oct 23, 2018 at 09:42:16AM +0200, Laurenz Albe wrote: > > No objections from me; on the contrary, I would like to thank you for > > your effort here. I appreciate that you probably spent more time > > tutoring me than it wo

Re: Large writable variables

2018-10-24 Thread Peter Eisentraut
On 18/10/2018 21:31, Andres Freund wrote: > On 2018-10-18 22:17:55 +0200, Peter Eisentraut wrote: >> I'd perhaps change the signature >> >> #define unconstify(underlying_type, var) >> >> because the "var" doesn't actually have to be a variable. > > Hm, so expr, or what would you use? done >> Att

Re: Log timestamps at higher resolution

2018-10-24 Thread David Rowley
On 25 October 2018 at 11:25, David Fetter wrote: > Digging a teensy bit deeper, I noticed that there's already a > "padding" (space padding, if I understand correctly) system for parts > of the log_line_prefix specification including %m. Did we get painted > into a corner here back in 9.4, when th

Re: BUG #15448: server process (PID 22656) was terminated by exception 0xC0000005

2018-10-24 Thread Andrew Dunstan
On 10/24/2018 07:00 PM, Michael Banck wrote: Hi, On Tue, Oct 23, 2018 at 07:46:01AM -0400, Andrew Dunstan wrote: diff --git a/src/test/regress/expected/fast_default.out b/src/test/regress/expected/fast_default.out index 48bd360..0797e11 100644 --- a/src/test/regress/expected/fast_default.ou

Re: BUG #15448: server process (PID 22656) was terminated by exception 0xC0000005

2018-10-24 Thread Michael Banck
Hi, On Tue, Oct 23, 2018 at 07:46:01AM -0400, Andrew Dunstan wrote: > diff --git a/src/test/regress/expected/fast_default.out > b/src/test/regress/expected/fast_default.out > index 48bd360..0797e11 100644 > --- a/src/test/regress/expected/fast_default.out > +++ b/src/test/regress/expected/fast_de

Re: Log timestamps at higher resolution

2018-10-24 Thread David Fetter
On Wed, Oct 24, 2018 at 03:17:09PM +0100, Tom Lane wrote: > Alvaro Herrera writes: > > On 2018-Oct-24, David Fetter wrote: > >> For another, having separate letter rather than number modifiers as > >> printf("%03d") does, is just lousy API design. > > > I don't think the API is lousy as all that,

Re: notice processors for isolationtester

2018-10-24 Thread Andres Freund
On 2018-10-24 18:34:51 -0300, Alvaro Herrera wrote: > Recently while testing a patch I found it immensely useful to > distinguish which session each WARNING message came from, when bespoke > tests were run under isolationtester. Current code does not show that, > so I developed this patch adding n

notice processors for isolationtester

2018-10-24 Thread Alvaro Herrera
Recently while testing a patch I found it immensely useful to distinguish which session each WARNING message came from, when bespoke tests were run under isolationtester. Current code does not show that, so I developed this patch adding notice processors, and then it does. -- Álvaro Herrera

Re: pgbench - add pseudo-random permutation function

2018-10-24 Thread Alvaro Herrera
On 2018-Oct-24, Fabien COELHO wrote: > > Hello Alvaro, > > > Can you please pgindent this? > > Hmmm. After some investigation, I installed some "pg_bsd_indent" and ran the > "pgindent" script, which reindented far more than the patch... So I picked > up the patch-related changes and integrated

Re: JSON validation behavior

2018-10-24 Thread Andrew Dunstan
On 10/24/2018 11:54 AM, Tom Lane wrote: "David G. Johnston" writes: The following does seem buggy though: select json '{ "a": "null \u escape"}' -> 'a' as fails; Perhaps, but AFAICS it's entirely accidental that any variant of this doesn't fail. Although this manages not to fail: regr

Re: pgbench - add pseudo-random permutation function

2018-10-24 Thread Fabien COELHO
Hello Alvaro, Can you please pgindent this? Hmmm. After some investigation, I installed some "pg_bsd_indent" and ran the "pgindent" script, which reindented far more than the patch... So I picked up the patch-related changes and integrated them manually, although not comment changes which

Re: Timeout parameters

2018-10-24 Thread AYahorau
Hello Ryohei, I took a look at your changes and I have some notes. I faced the same issue as you faced. In my opinion hanging of a client is quite critical case and it needs to be overcame. TCP_USER_TIMEOUT option helps to overcome this problem and I agree with you that it needs to be suppor

Re: Side effect of CVE-2017-7484 fix?

2018-10-24 Thread Robert Haas
On Mon, Oct 22, 2018 at 9:47 AM Tom Lane wrote: > Dilip Kumar writes: > > As part of the security fix > > (e2d4ef8de869c57e3bf270a30c12d48c2ce4e00c), we have restricted the > > users from accessing the statistics of the table if the user doesn't > > have privileges on the table and the function i

Re: Multiple Wait Events for extensions

2018-10-24 Thread legrand legrand
Would a hard coded solution as described here after possible for mid-term ? note: actual result from pgstat_report_wait_star(PG_WAIT_EXTENSION); is preserved. Regards PAscal pgstat.h /* -- * Wait Events - Extension * * Use this category when an extension is waiting. * -

Re: pgbench - add pseudo-random permutation function

2018-10-24 Thread Alvaro Herrera
Can you please pgindent this? -- Álvaro Herrerahttps://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Re: [PROPOSAL]a new data type 'bytea' for ECPG

2018-10-24 Thread Michael Meskes
Hi Matsumoro-san, thanks for your effort and apologies for the late reply. > I think that set/put data for host variable should be more simple. > The following is an example of Oracle Pro *C program for RAW type > column. Just to be clear, Oracle can use varchars for binary data, right? > In E

Re: JSON validation behavior

2018-10-24 Thread Sergei Kornilov
Hi > I could get behind fixing > it to always throw the error, but that's not what Sergei was hoping for. On the contrary i think it is reasonable way. It is much better to have error on input value instead of finding wrong value during table processing. We always reject this value for jsonb and

Re: JSON validation behavior

2018-10-24 Thread Tom Lane
"David G. Johnston" writes: > The following does seem buggy though: > select json '{ "a": "null \u escape"}' -> 'a' as fails; Perhaps, but AFAICS it's entirely accidental that any variant of this doesn't fail. Although this manages not to fail: regression=# select json '{ "a": "null \u

Re: Problem with EDB 11.0 Windows x64 distributions

2018-10-24 Thread Sandeep Thakkar
Hi Christian, There shouldn't be any problem with the installer (in non extract-only mode) and all the dependencies should be in place. Let us know if any binary is not working. For extract-only mode, let me confirm and fix the issues if any. Also, bin/libwinpthread-1.dll and bin/zilb1.dll were m

Re: JSON validation behavior

2018-10-24 Thread Sergei Kornilov
Hi 24.10.2018, 17:40, "David G. Johnston" : > On Wed, Oct 24, 2018 at 7:25 AM Sergei Kornilov wrote: > >> DETAIL:  \u cannot be converted to text. >> >> Well, requested text type can not have \u byte. But seems strange: we >> test json type with this value but raise same error for -> ope

Re: pgbench - add pseudo-random permutation function

2018-10-24 Thread Fabien COELHO
I thinks this patch is fine. Thanks! Hopefully some committer will pick it up at some point. -- Fabien.

pg_logdir_ls function throwing an error if log_filename name is not default

2018-10-24 Thread tushar
Hi , Please refer this small testcase - Open postgresql.conf file and set - log_destination = 'stderr' logging_collector = on log_directory = 'pg_log1' log_filename = 'abcd-%Y-%m-%d_%H%M%S.log' restart the server  , connect   to psql terminal and create adminpack extension and fire pg_logdir_

Re: pgbench - add pseudo-random permutation function

2018-10-24 Thread Hironobu SUZUKI
Hi Fabian-san, I reviewed 'pgbench-prp-func/pgbench-prp-func-10.patch'. On 2018/10/24 12:55, Fabien COELHO wrote: Hello Hironobu-san, In pseudorandom_perm(), `modular_multiply() + (key >> LCG_SHIFT)` may overflow if the result of modular_multiply() is large. Therefore, I've improved it.

Re: Estimating number of distinct values.

2018-10-24 Thread Jeff Janes
On Wed, Oct 24, 2018 at 10:07 AM Konstantin Knizhnik < k.knizh...@postgrespro.ru> wrote: > > Real number of distinct value for this dataset is about 10 millions. For > some reasons, sampling using random blocks and Vitter algorithm produces > worser results than just examining first 3 rows of

Re: JSON validation behavior

2018-10-24 Thread David G. Johnston
On Wed, Oct 24, 2018 at 7:25 AM Sergei Kornilov wrote: > > DETAIL: \u cannot be converted to text. > > Well, requested text type can not have \u byte. But seems strange: we > test json type with this value but raise same error for -> operator: > > We allow write such json to table, we al

Re: Estimating number of distinct values.

2018-10-24 Thread Tom Lane
Konstantin Knizhnik writes: > I will be pleased if somebody (first of all Robert) can comment me > "strange" results of distinct values estimation. Estimating the number of distinct values from a small sample is a hard problem; every algorithm is going to blow it in some cases. > In my case the

JSON validation behavior

2018-10-24 Thread Sergei Kornilov
Hi We have some json regression tests in src/test/regress/expected/json_encoding_1.out with \u symbol select json '{ "a": "null \u escape" }' as not_unescaped; not_unescaped { "a": "null \u escape" } (1 row) select json '{ "a":

Re: Log timestamps at higher resolution

2018-10-24 Thread David Fetter
On Wed, Oct 24, 2018 at 11:10:02AM +0100, Tom Lane wrote: > David Fetter writes: > > On Wed, Oct 24, 2018 at 08:00:24AM +1300, Thomas Munro wrote: > >> On Wed, Oct 24, 2018 at 7:51 AM David Fetter wrote: > >>> Per gripes I've been hearing with increasing frequency, please find > >>> attached a pa

Re: Log timestamps at higher resolution

2018-10-24 Thread Tom Lane
Alvaro Herrera writes: > On 2018-Oct-24, David Fetter wrote: >> For another, having separate letter rather than number modifiers as >> printf("%03d") does, is just lousy API design. > I don't think the API is lousy as all that, but a further improvement to > allow a precision specifier might be a

Estimating number of distinct values.

2018-10-24 Thread Konstantin Knizhnik
Hello hackers, I will be pleased if somebody (first of all Robert) can comment me "strange" results of distinct values estimation. There is the following code in analyze.c:        /*--              * Estimate the number of distinct values using the estimator              * propos

Re: Log timestamps at higher resolution

2018-10-24 Thread Alvaro Herrera
On 2018-Oct-24, David Fetter wrote: > For another, having separate letter rather than number modifiers as > printf("%03d") does, is just lousy API design. I don't think the API is lousy as all that, but a further improvement to allow a precision specifier might be a worthy feature addition -- say

Problem with EDB 11.0 Windows x64 distributions

2018-10-24 Thread Christian Ullrich
Hello, there are some problems with the 11.0 EDB installers and binary archives for Windows x64: - bin/libwinpthread-1.dll is only in the installer This is a dependency of libintl-9.dll, so without it, nearly everything in the Zip archive does not work. - zlib1.dll is only in the install

Re: pgbench - add pseudo-random permutation function

2018-10-24 Thread Fabien COELHO
Hello Hironobu-san, In pseudorandom_perm(), `modular_multiply() + (key >> LCG_SHIFT)` may overflow if the result of modular_multiply() is large. Therefore, I've improved it. Also, I've simplified Step 5 in modular_multiply(). Attached is a v10, where I have: - updated some comments - th

Re: Log timestamps at higher resolution

2018-10-24 Thread Tom Lane
David Fetter writes: > On Wed, Oct 24, 2018 at 08:00:24AM +1300, Thomas Munro wrote: >> On Wed, Oct 24, 2018 at 7:51 AM David Fetter wrote: >>> Per gripes I've been hearing with increasing frequency, please find >>> attached a patch that implements $Subject. It's microsecond resolution >>> becaus

RE: [PROPOSAL]a new data type 'bytea' for ECPG

2018-10-24 Thread Matsumura, Ryo
Hackers No one commented to the proposal, but I'm not discouraged. I attach a patch. Please review or comment to proposal. Note: - The patch cannot yet decode escape format data from backend. - [ecpg/test/expected/sql-bytea.stderr] in patch includes non-ascii data. I explain a little about the

Re: [PATCH] Tab complete EXECUTE FUNCTION for CREATE (EVENT) TRIGGER

2018-10-24 Thread Dagfinn Ilmari Mannsåker
David Fetter writes: > On Wed, Oct 24, 2018 at 08:43:05AM +0900, Michael Paquier wrote: >> On Tue, Oct 23, 2018 at 12:26:35PM +0100, Dagfinn Ilmari Mannsåker wrote: >> > The last-minute change for CREATE (EVENT) TRIGGER to accept EXECUTE >> > FUNCTION as well as EXECUTE PROCEDURE did not update t

Re: Side effect of CVE-2017-7484 fix?

2018-10-24 Thread Dilip Kumar
On Mon, Oct 22, 2018 at 7:40 PM David Fetter wrote: > > On Mon, Oct 22, 2018 at 04:43:52PM +0530, Dilip Kumar wrote: > > On Mon, Oct 22, 2018 at 11:22 AM David Fetter wrote: > > > > > > On Mon, Oct 22, 2018 at 11:10:09AM +0530, Dilip Kumar wrote: > > > > As part of the security fix > > > > (e2d4e

Re: Unordered wait event ClogGroupUpdate

2018-10-24 Thread Michael Paquier
On Wed, Oct 24, 2018 at 10:59:35AM +0530, Kuntal Ghosh wrote: > Nice. Same here. Thanks for confirming. I have committed the change, with HEAD making the structures and the documentation consistent. Down to 10, only the documentation has been changed, where it is adapted. -- Michael signature.