Re: Duplicate Item Pointers in Gin index

2018-06-12 Thread Peter Geoghegan
On Tue, Jun 12, 2018 at 11:01 PM, Masahiko Sawada wrote: > FWIW, I've looked at this again. I think that the situation Siva > reported in the first mail can happen before we get commit 3b2787e. > That is, gin indexes had had a data corruption bug. I've reproduced > the situation with PostgreSQL 10

Re: Duplicate Item Pointers in Gin index

2018-06-12 Thread Masahiko Sawada
On Thu, Feb 22, 2018 at 10:26 AM, Masahiko Sawada wrote: > On Thu, Feb 22, 2018 at 8:28 AM, Peter Geoghegan wrote: >> On Wed, Feb 21, 2018 at 3:02 PM, R, Siva wrote: >>> Did you mean pin on the metapage buffer during ginInsertCleanup and not lock >>> during addition of tuples to the accumulator?

Re: Server crashed with dense_rank on partition table.

2018-06-12 Thread Michael Paquier
On Wed, Jun 13, 2018 at 11:08:38AM +0530, Rajkumar Raghuwanshi wrote: > postgres=# SELECT dense_rank(b) WITHIN GROUP (ORDER BY a) FROM pagg_tab > GROUP BY b ORDER BY 1; > server closed the connection unexpectedly > This probably means the server terminated abnormally > before or while proce

Server crashed with dense_rank on partition table.

2018-06-12 Thread Rajkumar Raghuwanshi
Hi, I am getting server crash with below query. CREATE TABLE pagg_tab (a int, b int, c text) PARTITION BY LIST(c); CREATE TABLE pagg_tab_p1 PARTITION OF pagg_tab FOR VALUES IN ('', '0001', '0002', '0003'); CREATE TABLE pagg_tab_p2 PARTITION OF pagg_tab FOR VALUES IN ('0004', '0005', '0006', '

Re: Portability concerns over pq_sendbyte?

2018-06-12 Thread Michael Paquier
On Mon, Jun 11, 2018 at 02:25:44PM +0900, Michael Paquier wrote: > On Wed, Jun 06, 2018 at 12:27:58PM -0400, Alvaro Herrera wrote: >> Do you have an answer to this question? Does anybody else? >> >> (My guts tell me it'd be better to change these routines to take >> unsigned values, without creat

Re: why partition pruning doesn't work?

2018-06-12 Thread David Rowley
On 13 June 2018 at 16:15, Tom Lane wrote: > It seems not to be that bad: we just need a shutdown call for the > PartitionPruneState, and then we can remember the open relation there. > The attached is based on David's patch from yesterday. > > I'm still a bit annoyed at the fmgr_info_copy calls in

Re: BUG #15237: I got "ERROR: source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"

2018-06-12 Thread Andrew Gierth
[Pruning the CC list and moving this to -hackers] > "Tom" == Tom Lane writes: Tom> It's telling you what to do: use a ROW() expression, ie Tom> update fvt_obj_operate_update_table_033 set (c_int) = row(20) Tom> where c_int = 20; >> Yeah, but (a) this used to work, and has worked since a

Add function to release an allocated SQLDA

2018-06-12 Thread Kato, Sho
Hi, I add a function called ECPGfreeSQLDA() becasue there is no API for releasing the SQLDA stored the result set. An example of usage is as follows. Specify a pointer to sqlda_t to be released as an argument. Example: exec sql begin declare section; char*stmt1 = "SELECT * FROM

Re: why partition pruning doesn't work?

2018-06-12 Thread Tom Lane
Robert Haas writes: > On Tue, Jun 12, 2018 at 12:54 PM, Tom Lane wrote: >> While I've not looked into the exact reasons for that, my first guess >> is that the partitioned table is not held open because it's not one >> of the ones to be scanned. Are you prepared to change something like >> that

Re: Fix some error handling for read() and errno

2018-06-12 Thread Michael Paquier
On Tue, Jun 12, 2018 at 01:19:54PM +0900, Michael Paquier wrote: > Agreed. I also quite like the message mentioning directly 2PC files as > well. I think that we could gain by making all end messages more > consistent, as the markers used and the style of each message is > slightly different, so

Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development

2018-06-12 Thread Michael Paquier
On Wed, Jun 13, 2018 at 02:35:23PM +1200, Thomas Munro wrote: > It should be disabled on Windows, as you have it. > > ldap_initialize() is a non-standard extension that provides a way to > use "ldaps" with OpenLDAP, but we don't even support using OpenLDAP on > Windows. We know how to use Win32's

Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development

2018-06-12 Thread Thomas Munro
On Wed, Jun 13, 2018 at 2:06 PM, Michael Paquier wrote: > HAVE_LDAP_INITIALIZE is added in the list, but this is disabled as I > could not test it. It could always be possible to revisit that later. > Thomas, what do you think? It should be disabled on Windows, as you have it. ldap_initialize()

Re: Needless additional partition check in INSERT?

2018-06-12 Thread Amit Langote
On 2018/06/12 10:37, David Rowley wrote: > On 12 June 2018 at 09:13, Alvaro Herrera wrote: >> Hearing no complaints I pushed it with the proposed shape. > > Thanks for working on it and pushing. Thank you David and Alvaro. I think the last solution involving calling ExecPartitionCheck directly

Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development

2018-06-12 Thread Michael Paquier
On Wed, Jun 13, 2018 at 09:07:20AM +0900, Michael Paquier wrote: > What kind of failures are you seeing? I just compiled Postgres two days > ago with MSVC and OpenSSL 1.0.2o (oldest version with a Windows > installer I could find), and that was able to compile. On HEAD, OpenSSL > should be suppor

Re: Does logical replication supports cross platform servers?

2018-06-12 Thread Haribabu Kommi
On Tue, Jun 12, 2018 at 1:29 PM Craig Ringer wrote: > On 12 June 2018 at 11:04, Haribabu Kommi wrote: > >> Hi All, >> >> I am not able to find any docs suggesting that PostgreSQL logical >> replication supports >> cross platform servers (windows --> Linux or vice-versa). >> >> > It should. I don

Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development

2018-06-12 Thread Michael Paquier
On Tue, Jun 12, 2018 at 04:51:59PM -0400, Andrew Dunstan wrote: > On 06/12/2018 10:51 AM, Andrew Dunstan wrote: >> meanwhile, Bowerbird (MSVC) is on 1.0.1d, lorikeet (Cygwin64) is on >> 1.0.2d and jacana (Mingw) doesn't build with openssl. >> >> I will look at upgrading bowerbird ASAP. > > Well,

Re: [bug fix] Cascaded standby cannot start after a clean shutdown

2018-06-12 Thread Michael Paquier
On Tue, Jun 12, 2018 at 04:27:50PM +0900, Michael Paquier wrote: > On Tue, Jun 12, 2018 at 06:30:49AM +, Tsunakawa, Takayuki wrote: >> Thank you so much. This version looks better. >> >> + * this would cause the instance to stop suddendly with a hard failure, >> >> suddendly -> suddenly

Attempt to fix inheritance limitations: unique and foreign key constraints

2018-06-12 Thread Raphael Medaer
Hi pg-hackers, I'm trying to fix some of limitations in table inheritance. My first use case concerns "referencing" foreign keys in parent table. The attached patch propagates foreign keys to inherited tables. I'm automatically cloning foreign keys from parent table into children (with right

Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development

2018-06-12 Thread Andrew Dunstan
On 06/12/2018 10:51 AM, Andrew Dunstan wrote: meanwhile, Bowerbird (MSVC) is on 1.0.1d, lorikeet (Cygwin64) is on 1.0.2d and jacana (Mingw) doesn't build with openssl. I will look at upgrading bowerbird ASAP. Well, that crashed and burned. What versions of openssl are we supporting

Re: why partition pruning doesn't work?

2018-06-12 Thread Robert Haas
On Tue, Jun 12, 2018 at 12:54 PM, Tom Lane wrote: > Testing with valgrind + RELCACHE_FORCE_RELEASE is sufficient to disprove > that, cf current results from lousyjack (which match my own testing). > The partkey *is* disappearing under us. > > While I've not looked into the exact reasons for that,

Re: found xmin from before relfrozenxid on pg_catalog.pg_authid

2018-06-12 Thread Andres Freund
Hi, On 2018-06-11 17:39:14 -0700, Andres Freund wrote: > I plan to go over the change again tomorrow, and then push. Unless > somebody has comments before then, obviously. Done. - Andres

Re: why partition pruning doesn't work?

2018-06-12 Thread Tom Lane
Robert Haas writes: > And there is > code in RelationClearRelation to avoid changing rd_partkey and > rd_partdesc if no logical change has occurred. Oh, and by the way, what's actually in there is keep_partkey = (relation->rd_partkey != NULL); I would be interested to see an exp

Re: why partition pruning doesn't work?

2018-06-12 Thread Tom Lane
Robert Haas writes: > I think we DO hold relations open for the duration of execution > (though not necessarily between planning and execution). And there is > code in RelationClearRelation to avoid changing rd_partkey and > rd_partdesc if no logical change has occurred. Testing with valgrind +

Re: assert in nested SQL procedure call in current HEAD

2018-06-12 Thread Andrew Gierth
> "Peter" == Peter Eisentraut writes: >> Did you miss the fact that the issue only occurs when the top-level >> procedure does a rollback? The problem is not with nested calls, but >> rather with the fact that commit or rollback is leaving >> ActiveSnapshot unset, which is (as Tom pointed

Re: why partition pruning doesn't work?

2018-06-12 Thread Robert Haas
On Tue, Jun 12, 2018 at 12:25 PM, Tom Lane wrote: > Robert Haas writes: >> On Mon, Jun 11, 2018 at 6:24 PM, Tom Lane wrote: >>> Not sure about a good fix for this. It seems annoying to copy the >>> rel's whole partkey data structure into query-local storage, but >>> I'm not sure we have any cho

Re: [PATCH v18] GSSAPI encryption support

2018-06-12 Thread Nico Williams
On Tue, Jun 12, 2018 at 12:36:01PM -0400, Robbie Harwood wrote: > Nico Williams writes: > > On Mon, Jun 11, 2018 at 04:11:10PM -0400, Robbie Harwood wrote: > >> Nico was kind enough to provide me with some code review. This should > >> those concerns (clarify short-read behavior and fixing error

Re: [PATCH v18] GSSAPI encryption support

2018-06-12 Thread Robbie Harwood
Nico Williams writes: > On Mon, Jun 11, 2018 at 04:11:10PM -0400, Robbie Harwood wrote: >> Nico was kind enough to provide me with some code review. This should >> those concerns (clarify short-read behavior and fixing error checking on >> GSS functions). > > Besides the bug you fixed and which

Re: why partition pruning doesn't work?

2018-06-12 Thread Tom Lane
Robert Haas writes: > On Mon, Jun 11, 2018 at 6:24 PM, Tom Lane wrote: >> Not sure about a good fix for this. It seems annoying to copy the >> rel's whole partkey data structure into query-local storage, but >> I'm not sure we have any choice. On the bright side, there might >> be an opportunit

Re: late binding of shared libs for C functions

2018-06-12 Thread Andres Freund
On 2018-06-12 15:05:16 +0100, Andrew Gierth wrote: > > "Tom" == Tom Lane writes: > > > Andrew Gierth writes: > >> The real question is why check_function_bodies doesn't cover this; > >> there's a comment in fmgr_c_validator that this is deliberate, but it's > >> rather unclear what the a

Re: ON CONFLICT DO NOTHING on pg_dump

2018-06-12 Thread Nico Williams
On Tue, Jun 12, 2018 at 09:05:23AM +, Ideriha, Takeshi wrote: > >From: Surafel Temesgen [mailto:surafel3...@gmail.com] > >Subject: ON CONFLICT DO NOTHING on pg_dump > > >Sometimes I have to maintain two similar database and I have to update one > >from the other and notice having the option

Re: why partition pruning doesn't work?

2018-06-12 Thread Robert Haas
On Mon, Jun 11, 2018 at 6:24 PM, Tom Lane wrote: > Not sure about a good fix for this. It seems annoying to copy the > rel's whole partkey data structure into query-local storage, but > I'm not sure we have any choice. On the bright side, there might > be an opportunity to get rid of repeated ru

Re: assert in nested SQL procedure call in current HEAD

2018-06-12 Thread Peter Eisentraut
On 6/12/18 10:03, Andrew Gierth wrote: >> "Peter" == Peter Eisentraut writes: > > Peter> The problem with these nested procedure calls is that if the > Peter> nested call > > Did you miss the fact that the issue only occurs when the top-level > procedure does a rollback? The problem is not

Re: late binding of shared libs for C functions

2018-06-12 Thread Andrew Dunstan
On 06/12/2018 11:09 AM, Geoff Winkless wrote: On Tue, 12 Jun 2018 at 15:44, Christian Ullrich wrote: I did wonder about "NO CHECK" but wasn't sure if having two words would make the parser change more complex. DEFERRED? That's a good shout. I wouldn't mind either of those choices. So can

Re: late binding of shared libs for C functions

2018-06-12 Thread Geoff Winkless
On Tue, 12 Jun 2018 at 15:44, Christian Ullrich wrote: > > I did wonder about "NO CHECK" but wasn't sure if having two words > > would make the parser change more complex. > > DEFERRED? That's a good shout. I wouldn't mind either of those choices. So can I assume at least that no-one has an obje

Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development

2018-06-12 Thread Andrew Dunstan
On 06/12/2018 10:40 AM, Christian Ullrich wrote: *On 2018-06-12 16:21, Jonathan S. Katz wrote: On Jun 3, 2018, at 4:29 AM, Michael Paquier wrote: A script which reports the version of OpenSSL should be simple enough for MSVC.  And I am ready to bet that at least hamerkop is not using Ope

Re: late binding of shared libs for C functions

2018-06-12 Thread Christian Ullrich
* On 2018-06-12 16:35, Geoff Winkless wrote: On Tue, 12 Jun 2018 at 13:41, Andrew Dunstan wrote: UNBOUNDED would be terrible. It does not mean the same thing as UNBOUND. Indeed. I agree. Perhaps something like NO CHECK would meet the case, i.e. we're not checking the link at function crea

Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development

2018-06-12 Thread Christian Ullrich
*On 2018-06-12 16:21, Jonathan S. Katz wrote: On Jun 3, 2018, at 4:29 AM, Michael Paquier wrote: A script which reports the version of OpenSSL should be simple enough for MSVC. And I am ready to bet that at least hamerkop is not using OpenSSL 1.0.2, so a simple switch would most likely caus

Re: late binding of shared libs for C functions

2018-06-12 Thread Geoff Winkless
On Tue, 12 Jun 2018 at 13:41, Andrew Dunstan wrote: > On 06/12/2018 06:48 AM, Geoff Winkless wrote: > > +| AS 'obj_file', 'link_symbol' [UNBOUNDED] > > (I know UNBOUNDED isn't quite the word - BINDLATE would be better - > > but I figured I should try to use an existing reserved keyword...) > >

Re: pg_config.h.win32 missing a set of flags from pg_config.h.in added in v11 development

2018-06-12 Thread Jonathan S. Katz
> On Jun 3, 2018, at 4:29 AM, Michael Paquier wrote: > > On Sat, Jun 02, 2018 at 05:20:57PM -0400, Tom Lane wrote: >> Heikki Linnakangas writes: >>> On 02/06/18 17:09, Tom Lane wrote: More concerning is that RHEL6 is on 1.0.1e: >> >>> I was only thinking of requiring 1.0.2 on Windows. >>

Re: late binding of shared libs for C functions

2018-06-12 Thread Komяpa
> > >> The real question is why check_function_bodies doesn't cover this; > >> there's a comment in fmgr_c_validator that this is deliberate, but it's > >> rather unclear what the advantage is supposed to be: > > Tom> Error detection, ie did you spell the C symbol name correctly. > > Right, but

Re: late binding of shared libs for C functions

2018-06-12 Thread Andrew Gierth
> "Tom" == Tom Lane writes: > Andrew Gierth writes: >> The real question is why check_function_bodies doesn't cover this; >> there's a comment in fmgr_c_validator that this is deliberate, but it's >> rather unclear what the advantage is supposed to be: Tom> Error detection, ie did you

Re: assert in nested SQL procedure call in current HEAD

2018-06-12 Thread Andrew Gierth
> "Peter" == Peter Eisentraut writes: Peter> The problem with these nested procedure calls is that if the Peter> nested call Did you miss the fact that the issue only occurs when the top-level procedure does a rollback? The problem is not with nested calls, but rather with the fact that co

Re: late binding of shared libs for C functions

2018-06-12 Thread Tom Lane
Andrew Gierth writes: > The real question is why check_function_bodies doesn't cover this; > there's a comment in fmgr_c_validator that this is deliberate, but it's > rather unclear what the advantage is supposed to be: Error detection, ie did you spell the C symbol name correctly.

Re: cursors with prepared statements

2018-06-12 Thread Amit Kapila
On Mon, Jun 11, 2018 at 9:56 PM, Peter Eisentraut wrote: > On 6/11/18 09:57, Amit Kapila wrote: >> Sounds like a reasonable approach. Have you not considered using a >> special OPEN syntax because there are some other forms of problems >> with it? > > There is no OPEN command in direct SQL. Do y

Re: assert in nested SQL procedure call in current HEAD

2018-06-12 Thread Peter Eisentraut
On 6/10/18 15:06, Dmitry Dolgov wrote: >> I added it to the open items list since nobody else seems to have taken >> notice; from Tom's linked message it seems this should be Peter E's bag? > I've taken a look at this - indeed, the situation looks similar to what > described in the linked message,

Re: why partition pruning doesn't work?

2018-06-12 Thread Ashutosh Bapat
On Tue, Jun 12, 2018 at 3:54 AM, Tom Lane wrote: > > Not sure about a good fix for this. It seems annoying to copy the > rel's whole partkey data structure into query-local storage, but > I'm not sure we have any choice. On the bright side, there might > be an opportunity to get rid of repeated

Re: Remove mention in docs that foreign keys on partitioned tables are not supported

2018-06-12 Thread Ashutosh Bapat
On Sat, Jun 9, 2018 at 3:48 AM, Alvaro Herrera wrote: > On 2018-Jun-08, Alvaro Herrera wrote: > >> Actually, the column order doesn't matter for a trigger function, >> because these don't refer to columns by number but by name. So unless >> users write trigger functions in C and use hardcoded col

Re: Avoid extra Sort nodes between WindowAggs when sorting can be reused

2018-06-12 Thread Daniel Gustafsson
> On 30 May 2018, at 18:19, Daniel Gustafsson wrote: > > Currently, we can only reuse Sort nodes between WindowAgg nodes iff the > partitioning and ordering clauses are identical. If a window Sort node > sortorder is a prefix of another window, we could however reuse the Sort node > to hopefully

Re: late binding of shared libs for C functions

2018-06-12 Thread Andrew Dunstan
On 06/12/2018 08:46 AM, Andrew Gierth wrote: "Andrew" == Andrew Dunstan writes: Andrew> Perhaps something like NO CHECK would meet the case, i.e. we're Andrew> not checking the link at function creation time. The real question is why check_function_bodies doesn't cover this; there's a c

Re: late binding of shared libs for C functions

2018-06-12 Thread Andrew Gierth
> "Andrew" == Andrew Dunstan writes: Andrew> Perhaps something like NO CHECK would meet the case, i.e. we're Andrew> not checking the link at function creation time. The real question is why check_function_bodies doesn't cover this; there's a comment in fmgr_c_validator that this is delibe

Re: late binding of shared libs for C functions

2018-06-12 Thread Andrew Dunstan
On 06/12/2018 06:48 AM, Geoff Winkless wrote: Hi All Is it possible to use CREATE FUNCTION to link a shared library that doesn't yet exist? I don't think it is, but I might be missing something. If not, would it be something that people would be open to a patch for? I'm thinking of e.g. CRE

Re: late binding of shared libs for C functions

2018-06-12 Thread Komяpa
This thing also bites PostGIS upgrades. When distro's packaging system decides to upgrade PostGIS, or both Postgres/PostGIS at the same time, you may often get to a situation when you only have one version of PostGIS .so installed, and it's not the one referenced in catalog. There are workarounds

Re: why partition pruning doesn't work?

2018-06-12 Thread Andrew Dunstan
On 06/11/2018 06:41 PM, Andrew Dunstan wrote: On 06/11/2018 06:24 PM, Tom Lane wrote: If we had any buildfarm critters running valgrind on RELCACHE_FORCE_RELEASE or CLOBBER_CACHE_ALWAYS builds, they'd have detected use of uninitialized memory here ... but I don't think we have any.  (The c

Re: Does logical replication supports cross platform servers?

2018-06-12 Thread Andrew Dunstan
On 06/11/2018 11:28 PM, Craig Ringer wrote: On 12 June 2018 at 11:04, Haribabu Kommi > wrote: Hi All, I am not able to find any docs suggesting that PostgreSQL logical replication supports cross platform servers (windows --> Linux or vice-vers

late binding of shared libs for C functions

2018-06-12 Thread Geoff Winkless
Hi All Is it possible to use CREATE FUNCTION to link a shared library that doesn't yet exist? I don't think it is, but I might be missing something. If not, would it be something that people would be open to a patch for? I'm thinking of e.g. CREATE [ OR REPLACE ] FUNCTION name ( [ [ argmode

Re: Proposal: Partitioning Advisor for PostgreSQL

2018-06-12 Thread Julien Rouhaud
Hi, On Tue, Jun 12, 2018 at 11:14 AM, Dilip Kumar wrote: > On Thu, May 24, 2018 at 4:16 PM, Yuzuko Hosoya > wrote: >> >> This is >> why we are working on partitioning advisor. We plan to release the first >> version >> of partitioning advisor for PostgreSQL 11, and then, improve it for >> Postg

Re: Proposal: Partitioning Advisor for PostgreSQL

2018-06-12 Thread Dilip Kumar
On Thu, May 24, 2018 at 4:16 PM, Yuzuko Hosoya wrote: > Hello, > > I'm Yuzuko Hosoya. This is my first PostgreSQL project participation. > > I have been developing partitioning advisor prototype with Julien Rouhaud. > It will be a new feature of HypoPG[1], which is a PostgreSQL extension, and > w

RE: ON CONFLICT DO NOTHING on pg_dump

2018-06-12 Thread Ideriha, Takeshi
>From: Surafel Temesgen [mailto:surafel3...@gmail.com] >Subject: ON CONFLICT DO NOTHING on pg_dump >Sometimes I have to maintain two similar database and I have to update one >from the other and notice having the option to add ON CONFLICT DO NOTHING >clause to >INSERT command in the dump data w

Re: Proposal: Partitioning Advisor for PostgreSQL

2018-06-12 Thread Ashutosh Bapat
On Tue, Jun 12, 2018 at 12:21 AM, Julien Rouhaud wrote: > > I both like and dislike this idea. The good thing is that it's way > less hacky than what we did in our prototype, and it's also working > out of the box. However, the problem I have with this approach is > that the generated plans will

Re: why partition pruning doesn't work?

2018-06-12 Thread David Rowley
On 12 June 2018 at 10:24, Tom Lane wrote: > After looking closer, that code isn't just inefficient, it's flat > out broken. The reason is that ExecSetupPartitionPruneState thinks > it can store some pointers into the target relation's relcache entry > in the PartitionPruneContext, and then contin

Re: [bug fix] Cascaded standby cannot start after a clean shutdown

2018-06-12 Thread Michael Paquier
On Tue, Jun 12, 2018 at 06:30:49AM +, Tsunakawa, Takayuki wrote: > Thank you so much. This version looks better. > > + * this would cause the instance to stop suddendly with a hard failure, > > suddendly -> suddenly Yep. Thanks for the extra lookup. -- Michael signature.asc Descript