Re:PATCH: standby crashed when replay block which truncated in standby but failed to truncate in master node

2019-09-23 Thread Thunder
Is this an issue? Can we fix like this? Thanks! At 2019-09-22 00:38:03, "Thunder" wrote: The step to reproduce this issue. 1. Create a table create table gist_point_tbl(id int4, p point); create index gist_pointidx on gist_point_tbl using gist(p); 2. Insert data insert into gis

Re: Global temporary tables

2019-09-23 Thread Konstantin Knizhnik
On 20.09.2019 19:43, Pavel Stehule wrote: 1. I do not need them at all. 2. Eliminate catalog bloating. 3. Mostly needed for compatibility with Oracle (simplify porting,...). 4. Parallel query execution. 5. Can be used at replica. 6. More efficient use of resources (firs

Re: Efficient output for integer types

2019-09-23 Thread Tels
Moin, On 2019-09-22 23:58, David Fetter wrote: On Sat, Sep 21, 2019 at 07:29:25AM +0100, Andrew Gierth wrote: > "David" == David Fetter writes: Fixed. Good work, more performance is sure nice :) Noticed one more thing in the patch: - *start++ = *a; - *a-

Re: pgbench - allow to create partitioned tables

2019-09-23 Thread Amit Kapila
On Mon, Sep 23, 2019 at 11:58 AM Fabien COELHO wrote: > > > Hello Amit, > > > It is better for a user to write a custom script for such cases. > > I kind-of agree, but IMHO this is not for pgbench to decide what is better > for the user and to fail on a script that would not fail. > > > Because af

Re: Attempt to consolidate reading of XLOG page

2019-09-23 Thread Antonin Houska
Alvaro Herrera wrote: > I was confused by the struct name XLogSegment -- the struct is used to > represent a WAL segment while it's kept open, rather than just a WAL > segment in abstract. Also, now that we've renamed everything to use the > term WAL, it seems wrong to use the name XLog for new

Hi guys, HELP please

2019-09-23 Thread Castillo, Steven (Agile)
Hi, I wonder if you guys can help me with this, I've been struggling with this query for almost a week and I haven't been able to tune it, it runs forever and I need it to run fast. Regards. Steven Castillo Time Release Plan.sql Description: Time Release Plan.sql Time Release Query.sql De

Re: Hi guys, HELP please

2019-09-23 Thread Tomas Vondra
On Fri, Sep 20, 2019 at 09:21:59PM +, Castillo, Steven (Agile) wrote: Hi, I wonder if you guys can help me with this, I've been struggling with this query for almost a week and I haven't been able to tune it, it runs forever and I need it to run fast. Hard to say, because all we have is a

Re: PATCH: standby crashed when replay block which truncated in standby but failed to truncate in master node

2019-09-23 Thread Tomas Vondra
On Mon, Sep 23, 2019 at 03:48:50PM +0800, Thunder wrote: Is this an issue? Can we fix like this? Thanks! I do think it is a valid issue. No opinion on the fix yet, though. The report was sent on saturday, so patience ;-) regards -- Tomas Vondra http://www.2ndQuadrant.com Pos

Re: Efficient output for integer types

2019-09-23 Thread Andrew Gierth
> "David" == David Fetter writes: David> + return pg_ltostr_zeropad(str, (uint32)0 - (uint32)value, minwidth - 1); No, this is just reintroducing the undefined behavior again. Once the value has been converted to unsigned you can't cast it back to signed or pass it to a function expecting

Re: Unwanted expression simplification in PG12b2

2019-09-23 Thread Robert Haas
On Sun, Sep 22, 2019 at 7:47 AM Darafei "Komяpa" Praliaskouski wrote: > A heuristic I believe should help my case (and I hardly imagine how it can > break others) is that in presence of Gather, all the function calls that are > parallel safe should be pushed into it. The cost of pushing data th

Proposal: Better query optimization for "NOT IN" clause

2019-09-23 Thread John Bester
One-line Summary: Better query optimization for "NOT IN" clause Business Use-case: Using x NOT IN (SELECT y FROM target) on extremely large tables can be done very fast. This might be necessary in order to introduce foreign keys where old systems re

Re: [proposal] de-TOAST'ing using a iterator

2019-09-23 Thread Binguo Bao
Alvaro Herrera 于2019年9月17日周二 上午5:51写道: > On 2019-Sep-10, Binguo Bao wrote: > > > +/* > > + * Support for de-TOASTing toasted value iteratively. "need" is a > pointer > > + * between the beginning and end of iterator's ToastBuffer. The marco > > + * de-TOAST all bytes before "need" into iterator's

Re: Commit fest 2019-09

2019-09-23 Thread Alvaro Herrera
Hello The fourth week of this commitfest begins with these numbers: statusstring │ week1 │ week2 │ week3 │ week4 ┼───┼───┼───┼─── Needs review │ 165 │ 138 │ 116 │ 118 Waiting on Author │30 │44 │51 │44 Rea

Re: Wrong sentence in the README?

2019-09-23 Thread Daniel Westermann (DWE)
"Daniel Westermann (DWE)" writes: >> in the README, top level, there is this: >> PostgreSQL has many language interfaces, many of which are listed here: >> https://www.postgresql.org/download >> I don't think the download page lists any language interfaces or do I miss >> something? >Not direc

overhead due to casting extra parameters with aggregates (over and over)

2019-09-23 Thread Tomas Vondra
Hi, I've been working on a custom aggregate, and I've ran into some fairly annoying overhead due to casting direct parameters over and over. I'm wondering if there's a way to eliminate this, somehow, without having to do an explicit cast. Imagine you have a simple aggregate: CREATE AGGREGATE t

Re: pg_upgrade check fails on Solaris 10

2019-09-23 Thread Marina Polyakova
On 2019-09-18 17:36, Alvaro Herrera wrote: On 2019-Sep-17, Marina Polyakova wrote: Hello, hackers! We got an error for pg_upgrade check on the branch REL_11_STABLE (commit 40ad4202513c72f5c1beeb03e26dfbc8890770c0) on Solaris 10 because IIUC the argument to the sed command is not enclosed in

Re: pg_upgrade check fails on Solaris 10

2019-09-23 Thread Alvaro Herrera
On 2019-Sep-23, Marina Polyakova wrote: > On 2019-09-18 17:36, Alvaro Herrera wrote: > > On 2019-Sep-17, Marina Polyakova wrote: > > > > > We got an error for pg_upgrade check on the branch REL_11_STABLE > > > (commit > > > 40ad4202513c72f5c1beeb03e26dfbc8890770c0) on Solaris 10 because IIUC > >

Re: [proposal] de-TOAST'ing using a iterator

2019-09-23 Thread Alvaro Herrera
Paul Ramsey, do you have opinions to share about this patch? I think PostGIS might benefit from it. Thread starts here: https://postgr.es/m/cal-ogks_onzpc9m9bxpcztmofwulcfkyecekiagxzwrl8kx...@mail.gmail.com -- Álvaro Herrerahttps://www.2ndQuadrant.com/ PostgreSQL Development, 2

Re: Global temporary tables

2019-09-23 Thread Pavel Stehule
po 23. 9. 2019 v 9:57 odesílatel Konstantin Knizhnik < k.knizh...@postgrespro.ru> napsal: > > > On 20.09.2019 19:43, Pavel Stehule wrote: > > > 1. I do not need them at all. >> 2. Eliminate catalog bloating. >> 3. Mostly needed for compatibility with Oracle (simplify porting,...). >> 4. Parallel q

Re: JSONPATH documentation

2019-09-23 Thread Steven Pousty
JSON Containment, JSONPath, and Transforms are means to work with JSONB but not the actual datatype itself. Doc should be split into 1) Data type - how do declare, indexing, considerations when using it... 2) Ways to work with the data type - functions, containment, JSONPath... These can be separa

Re: overhead due to casting extra parameters with aggregates (over and over)

2019-09-23 Thread Tom Lane
Tomas Vondra writes: > I've been working on a custom aggregate, and I've ran into some fairly > annoying overhead due to casting direct parameters over and over. I'm > wondering if there's a way to eliminate this, somehow, without having to > do an explicit cast. > Imagine you have a simple aggre

Re: overhead due to casting extra parameters with aggregates (over and over)

2019-09-23 Thread Tomas Vondra
On Mon, Sep 23, 2019 at 12:53:36PM -0400, Tom Lane wrote: Tomas Vondra writes: I've been working on a custom aggregate, and I've ran into some fairly annoying overhead due to casting direct parameters over and over. I'm wondering if there's a way to eliminate this, somehow, without having to do

Re: JSONPATH documentation

2019-09-23 Thread Alexander Korotkov
On Mon, Sep 23, 2019 at 7:52 PM Steven Pousty wrote: > JSON Containment, JSONPath, and Transforms are means to work with JSONB but > not the actual datatype itself. Doc should be split into > 1) Data type - how do declare, indexing, considerations when using it... > 2) Ways to work with the data

Re: scorpionfly needs more semaphores

2019-09-23 Thread Mikael Kjellström
On 2019-09-23 00:29, Thomas Munro wrote: On Wed, Sep 18, 2019 at 4:55 PM jungle boogie wrote: $ sysctl | ag kern.seminfo.semmni kern.seminfo.semmni=100 It still seems to be happening. Perhaps you need to increase semmns too? I have on my OpenBSD 6.5 /etc/sysctl.conf the following: kern.se

Re: JSONPATH documentation

2019-09-23 Thread Steven Pousty
Hey there: Thanks for the education on the path spec. Too bad it is in a zip doc - do you know of a place where it is publicly available so we can link to it? Perhaps there is some document or page you think would be a good reference read for people who want to understand more? https://standards.is

Re: Cache lookup errors with functions manipulation object addresses

2019-09-23 Thread Dmitry Dolgov
> On Tue, Jul 2, 2019 at 9:28 AM Michael Paquier wrote: > > On Thu, Feb 21, 2019 at 04:40:13PM +0900, Michael Paquier wrote: > > Rebased version fixing some conflicts with HEAD. > > And rebased version for this stuff on HEAD (66c5bd3), giving visibly > v16. Thanks for the patch! I couldn't check

Re: Proposal: Better query optimization for "NOT IN" clause

2019-09-23 Thread legrand legrand
Hello, Just for information there are some works regarding how to include this in core, that may interest you ;o) see "NOT IN subquery optimization" https://www.postgresql.org/message-id/flat/1550706289606-0.post%40n3.nabble.com commitfest entry: https://commitfest.postgresql.org/24/2023/ and "

Re: JSONPATH documentation

2019-09-23 Thread Alexander Korotkov
Hi! On Mon, Sep 23, 2019 at 10:10 PM Steven Pousty wrote: > Thanks for the education on the path spec. Too bad it is in a zip doc - do > you know of a place where it is publicly available so we can link to it? > Perhaps there is some document or page you think would be a good reference > read

Re: JSONPATH documentation

2019-09-23 Thread Steven Pousty
Privet :D On Mon, Sep 23, 2019 at 12:29 PM Alexander Korotkov < a.korot...@postgrespro.ru> wrote: > Hi! > > On Mon, Sep 23, 2019 at 10:10 PM Steven Pousty > wrote: > > > https://standards.iso.org/ittf/PubliclyAvailableStandards/c067367_ISO_IEC_TR_19075-6_2017.zip > > Yes, this link looks good t

Re: Psql patch to show access methods info

2019-09-23 Thread Alexander Korotkov
On Wed, Sep 18, 2019 at 5:04 PM Alvaro Herrera wrote: > On 2019-Sep-18, Alexander Korotkov wrote: > > > On Tue, Sep 17, 2019 at 9:01 PM Alvaro Herrera > > wrote: > > > > I think \dAf is just as critical as \dAo; the former lets you know which > > > opfamilies you can use in CREATE INDEX, while t

Re: subscriptionCheck failures on nightjar

2019-09-23 Thread Andrew Dunstan
On 9/20/19 6:17 PM, Tom Lane wrote: > Alvaro Herrera writes: >> Uh .. I didn't think it was possible that we would build the same >> snapshot file more than once. Isn't that a waste of time anyway? Maybe >> we can fix the symptom by just not doing that in the first place? >> I don't have a str

Re: Efficient output for integer types

2019-09-23 Thread David Fetter
On Mon, Sep 23, 2019 at 10:28:09AM +0200, Tels wrote: > Moin, > > On 2019-09-22 23:58, David Fetter wrote: > > On Sat, Sep 21, 2019 at 07:29:25AM +0100, Andrew Gierth wrote: > > > > "David" == David Fetter writes: > > > Fixed. > > Good work, more performance is sure nice :) > > Noticed one

[PATCH] Sort policies and triggers by table name in pg_dump.

2019-09-23 Thread Benjie Gillam
Hello all, Currently pg_dump sorts most dumpable objects by priority, namespace, name and then object ID. Since triggers and RLS policies belong to tables, there may be more than one with the same name within the same namespace, leading to potential sorting discrepancies between databases that onl

Re: Efficient output for integer types

2019-09-23 Thread David Fetter
On Mon, Sep 23, 2019 at 01:16:36PM +0100, Andrew Gierth wrote: > > "David" == David Fetter writes: > > David> + return pg_ltostr_zeropad(str, (uint32)0 - (uint32)value, minwidth - > 1); > > No, this is just reintroducing the undefined behavior again. Once the > value has been converted to

Re: scorpionfly needs more semaphores

2019-09-23 Thread Jungle Boogie
On Mon Sep 23, 2019 at 8:34 PM Mikael Kjellström wrote: > On 2019-09-23 00:29, Thomas Munro wrote: > > On Wed, Sep 18, 2019 at 4:55 PM jungle boogie > > wrote: > >> $ sysctl | ag kern.seminfo.semmni > >> kern.seminfo.semmni=100 > > > > It still seems to be happening. Perhaps you need to increas

Re: Attempt to consolidate reading of XLOG page

2019-09-23 Thread Alvaro Herrera from 2ndQuadrant
On 2019-Sep-23, Alvaro Herrera wrote: > I spent a couple of hours on this patchset today. I merged 0001 and > 0002, and decided the result was still messier than I would have liked, > so I played with it a bit more -- see attached. -- Álvaro Herrerahttps://www.2ndQuadrant.com/

Re: Attempt to consolidate reading of XLOG page

2019-09-23 Thread Alvaro Herrera
I spent a couple of hours on this patchset today. I merged 0001 and 0002, and decided the result was still messier than I would have liked, so I played with it a bit more -- see attached. I think this is committable, but I'm afraid it'll cause quite a few conflicts with the rest of your series.

Re: Cache lookup errors with functions manipulation object addresses

2019-09-23 Thread Michael Paquier
On Mon, Sep 23, 2019 at 09:15:24PM +0200, Dmitry Dolgov wrote: > Thanks for the patch! I couldn't check it in action, since looks like it > doesn't apply anymore [1] (although after a quick check I'm not entirely sure > why). Nevertheless I have a few short commentaries: Thanks for the review. Th

RE: [bug fix??] Fishy code in tts_cirtual_copyslot()

2019-09-23 Thread Tsunakawa, Takayuki
From: Tom Lane [mailto:t...@sss.pgh.pa.us] > I temporarily changed the Assert to be "==" rather than "<=", and > it still passed check-world, so evidently we are not testing any > cases where the descriptors are of different lengths. This explains > the lack of symptoms. It's still a bug though,

Re: Unwanted expression simplification in PG12b2

2019-09-23 Thread Finnerty, Jim
If the function was moved to the FROM clause where it would be executed as a lateral cross join instead of a target list expression, how would this affect the cost-based positioning of the Gather? On 9/23/19, 8:59 AM, "Robert Haas" wrote: On Sun, Sep 22, 2019 at 7:47 AM Darafei "Komяpa" P

Re: PATCH: standby crashed when replay block which truncated in standby but failed to truncate in master node

2019-09-23 Thread Michael Paquier
On Mon, Sep 23, 2019 at 01:45:14PM +0200, Tomas Vondra wrote: > On Mon, Sep 23, 2019 at 03:48:50PM +0800, Thunder wrote: >> Is this an issue? >> Can we fix like this? >> Thanks! >> > > I do think it is a valid issue. No opinion on the fix yet, though. > The report was sent on saturday, so patienc

Fix example in partitioning documentation

2019-09-23 Thread Amit Langote
Hi, As of v12, Append node is elided when there's a single subnode under it. An example in the partitioning documentation needs to be fixed to account for that change. Attached a patch. Thanks, Amit doc-partitioning.patch Description: Binary data

Re: [PATCH] Sort policies and triggers by table name in pg_dump.

2019-09-23 Thread Michael Paquier
On Mon, Sep 23, 2019 at 10:34:07PM +0100, Benjie Gillam wrote: > The attached draft patch (made against `pg_dump_sort.c` on master) breaks > ties for trigger and policy objects by using the table name, increasing the > sort order stability. I have compiled it and executed it against a number of > l

Re: Add "password_protocol" connection parameter to libpq

2019-09-23 Thread Michael Paquier
On Sat, Sep 21, 2019 at 11:24:30AM +0900, Michael Paquier wrote: > And both make sense. > > + * Return true if channel binding was employed and the scram exchange > upper('scram')? > > Except for this nit, it looks good to me. For the archive's sake: this has been committed as of d6e612f. - *

Re: Fix example in partitioning documentation

2019-09-23 Thread Michael Paquier
On Tue, Sep 24, 2019 at 10:52:30AM +0900, Amit Langote wrote: > As of v12, Append node is elided when there's a single subnode under > it. An example in the partitioning documentation needs to be fixed to > account for that change. Attached a patch. Indeed, using the same example as the docs: CR

Re: Custom reloptions and lock modes

2019-09-23 Thread Michael Paquier
On Fri, Sep 20, 2019 at 12:40:51PM +0530, Kuntal Ghosh wrote: > Okay. Sounds good. Thanks for the review. Attached is the patch set I am planning to commit. I'll wait after the tag of this week as the first patch needs to go down to 9.6, the origin of the bug being 47167b7. The second patch wou

Re: Fix example in partitioning documentation

2019-09-23 Thread Amit Langote
On Tue, Sep 24, 2019 at 11:14 AM Michael Paquier wrote: > On Tue, Sep 24, 2019 at 10:52:30AM +0900, Amit Langote wrote: > > As of v12, Append node is elided when there's a single subnode under > > it. An example in the partitioning documentation needs to be fixed to > > account for that change.

Re: [PATCH] src/test/modules/dummy_index -- way to test reloptions from inside of access method

2019-09-23 Thread Michael Paquier
On Fri, Sep 20, 2019 at 08:58:27PM +0900, Michael Paquier wrote: > I still need to do an extra pass on the code (particularly the AM > part), but I think that we could commit that. Please note that I > included the fix for the lockmode I sent today so as the patch can be > tested: > https://www.po

Re: PATCH: standby crashed when replay block which truncated in standby but failed to truncate in master node

2019-09-23 Thread Kyotaro Horiguchi
Hello. At Tue, 24 Sep 2019 10:40:19 +0900, Michael Paquier wrote in <20190924014019.gb2...@paquier.xyz> > On Mon, Sep 23, 2019 at 01:45:14PM +0200, Tomas Vondra wrote: > > On Mon, Sep 23, 2019 at 03:48:50PM +0800, Thunder wrote: > >> Is this an issue? > >> Can we fix like this? > >> Thanks! > >>

Re: Efficient output for integer types

2019-09-23 Thread David Fetter
On Mon, Sep 23, 2019 at 11:35:07PM +0200, David Fetter wrote: > On Mon, Sep 23, 2019 at 01:16:36PM +0100, Andrew Gierth wrote: Per discussion on IRC, change some functions to take only unsigned integer types so as not to branch for the case of negative numbers they're never actually called with.

Re: Memory Accounting

2019-09-23 Thread Michael Paquier
On Wed, Jul 24, 2019 at 11:52:28PM +0200, Tomas Vondra wrote: > I think Heikki was asking about places with a lot of sub-contexts, which a > completely different issue. It used to be the case that some aggregates > created a separate context for each group - like array_agg. That would > make Jeff's

recovery starting when backup_label exists, but not recovery.signal

2019-09-23 Thread Fujii Masao
Hi, When backup_label exists, the startup process enters archive recovery mode even if recovery.signal file doesn't exist. In this case, the startup process tries to retrieve WAL files by using restore_command. Then, at the beginning of the archive recovery, the contents of backup_label are copied

Re: Efficient output for integer types

2019-09-23 Thread David Fetter
On Tue, Sep 24, 2019 at 06:30:18AM +0200, David Fetter wrote: > On Mon, Sep 23, 2019 at 11:35:07PM +0200, David Fetter wrote: > > On Mon, Sep 23, 2019 at 01:16:36PM +0100, Andrew Gierth wrote: > > Per discussion on IRC, change some functions to take only unsigned > integer types so as not to branc

Re: PATCH: standby crashed when replay block which truncated in standby but failed to truncate in master node

2019-09-23 Thread Kyotaro Horiguchi
At Tue, 24 Sep 2019 12:46:19 +0900 (Tokyo Standard Time), Kyotaro Horiguchi wrote in <20190924.124619.248088532.horikyota@gmail.com> > > clear about that. In short, as a matter of safety I'd like to think > > that what you are suggesting is rather acceptable (aka hold interrupts > > before

Re: Option to dump foreign data in pg_dump

2019-09-23 Thread Surafel Temesgen
On Fri, Sep 20, 2019 at 6:20 PM Luis Carril wrote: > Hello, >thanks for the comments! > > * + if (tdinfo->filtercond || tbinfo->relkind == RELKIND_FOREIGN_TABLE) > > filter condition is not implemented completely yet so the logic only work > on foreign table so I think its better to handle it

Re: Cache lookup errors with functions manipulation object addresses

2019-09-23 Thread Kyotaro Horiguchi
At Tue, 24 Sep 2019 08:58:50 +0900, Michael Paquier wrote in <20190923235850.ga2...@paquier.xyz> > On Mon, Sep 23, 2019 at 09:15:24PM +0200, Dmitry Dolgov wrote: > Please feel free to use the updated versions attached. These can > apply on top of HEAD at 30d1379. In 0003, empty string and NULL