[HACKERS] Is it possible to get query_string value in an event trigger?

2017-05-22 Thread Jeremy Finzel
Hello. Is it possible to get the currently executing query in an event trigger, for example, a create table event trigger function firing after ddl_command_end, aside from checking pg_stat_activity for the current process? When I am debugging the source code, after executing a statement I can

Re: [HACKERS] psql - add special variable to reflect the last query status

2017-05-22 Thread Pavel Stehule
2017-05-22 9:40 GMT+02:00 Fabien COELHO : > > Hello Pavel, > > After some discussions about what could be useful since psql scripts now accepts tests, this patch sets a few variables which can be used by psql after a "front door" (i.e. actually typed by the user)

Re: [HACKERS] PATCH: recursive json_populate_record()

2017-05-22 Thread Nikita Glukhov
Attached two small fixes for the previous committed patch: 1. I've noticed a difference in behavior between json_populate_record() and jsonb_populate_record() if we are trying to populate record from a non-JSON-object: json function throws an error but jsonb function returns a record with NULL

Re: [HACKERS] plpgsql, caching, resowners and jit

2017-05-22 Thread Tom Lane
Andres Freund writes: > After doing so, I got pretty weird crashes. A bit of debugging later it > became apparent that the issue is in how plpgsql caches expression > states: ... > which means we'll re-use ExprStates built in another subtransaction. Sure, why not? They

Re: [HACKERS] psql - add special variable to reflect the last query status

2017-05-22 Thread Fabien COELHO
Please find attached a v2 which hopefully takes into account all your points above. Open question: should it gather more PQerrorResultField, or the two selected one are enough? If more, which should be included? I don't think so it is necessary. No in this moment. ERROR_CODE and

Re: [HACKERS] psql - add special variable to reflect the last query status

2017-05-22 Thread Pavel Stehule
2017-05-22 21:33 GMT+02:00 Fabien COELHO : > > Please find attached a v2 which hopefully takes into account all your >>> points above. >>> >>> Open question: should it gather more PQerrorResultField, or the two >>> selected one are enough? If more, which should be included?

[HACKERS] ALTER PUBLICATION materializing the list of tables

2017-05-22 Thread Jeff Janes
If I create a publication FOR ALL TABLES and then change my mind, the only thing I can do is drop the publication and recreate it. Since "ALTER PUBLICATION name SET TABLE" allows you to replace the entire table list, shouldn't it also let you change from the dynamic FOR ALL TABLES to a static

[HACKERS] Create subscription with `create_slot=false` and incorrect slot name

2017-05-22 Thread Dmitry Dolgov
Hi Maybe this question was already raised before, but I couldn't find a discussion. When I'm creating a subscription with `create_slot=false` looks like it's possible to pass a slot name with invalid characters. In this particular case both publisher and subscriber were on the same machine:

[HACKERS] ALTER PUBLICATION documentation

2017-05-22 Thread Jeff Janes
"The first variant of this command listed in the synopsis can change all of the publication properties specified in CREATE PUBLICATION ." That referenced first variant no longer exists. I don't if that should just be

Re: [HACKERS] PG10 Crash-safe and replicable Hash Indexes and UNIQUE

2017-05-22 Thread Alvaro Herrera
Chapman Flack wrote: > That was what gave me the idea in the first place, which then > I realized could be more generally useful. If I could say > something like > > CREATE INDEX ON foo USING btree ( bar, baz ALSO quux ); > > so that only bar and baz are compared in insertion and search, > but

[HACKERS] Improve logical decoding error message (was wal_level > WAL_LEVEL_LOGICAL)

2017-05-22 Thread Neha Khatri
On Mon, May 22, 2017 at 11:08 PM, Neha Khatri wrote: > As per my understabding, current postgres server supports only three > values for wal_level i.e. 'minimal' , 'replica' or 'logical'. But > following error message brought to notice that there are various code > spots

Re: [HACKERS] translatable string fixes

2017-05-22 Thread Alvaro Herrera
It took me a very long time to figure out how to translate these 9.6-new strings in the AM validate routines: msgid "gin operator family \"%s\" contains support procedure %s with cross-type registration" The problem I had was that the term "cross-type registration" is not used anywhere else,

Re: [HACKERS] Improve logical decoding error message (was wal_level > WAL_LEVEL_LOGICAL)

2017-05-22 Thread Michael Paquier
On Tue, May 23, 2017 at 8:08 AM, Neha Khatri wrote: > The Logical Decoding example in the documentation says: > > "Before you can use logical decoding, you must set wal_level to logical > and max_replication_slots to at least 1." > > But above error message is not exactly

Re: [HACKERS] psql - add special variable to reflect the last query status

2017-05-22 Thread Fabien COELHO
Hello Pavel, I have not any other comments. The implementation is trivial. [...] Indeed. I'll mark this patch as ready for commiters. Thanks for the review. -- Fabien. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

Re: [HACKERS] PG10 Crash-safe and replicable Hash Indexes and UNIQUE

2017-05-22 Thread Chapman Flack
On 05/22/17 18:39, Alvaro Herrera wrote: > Chapman Flack wrote: >> CREATE INDEX ON foo USING btree ( bar, baz ALSO quux ); > > INCLUDING: > https://www.postgresql.org/message-id/56168952.4010...@postgrespro.ru I'd buy that. -Chap -- Sent via pgsql-hackers mailing list

Re: [HACKERS] Improve logical decoding error message (was wal_level > WAL_LEVEL_LOGICAL)

2017-05-22 Thread Alvaro Herrera
Neha Khatri wrote: > On Tue, May 23, 2017 at 10:26 AM, Michael Paquier > There is no wal_level higher than logical, so the current sense looks > > perfectly fine to me. > > If there is no wal_level higher than logical, should the following error > message indicate to

Re: [HACKERS] Error-like LOG when connecting with SSL for password authentication

2017-05-22 Thread Vaishnavi Prabakaran
On Mon, May 22, 2017 at 5:10 PM, Michael Paquier wrote: > If the protocol version is SSL > 3.0 or TLS 1.0, this result code is returned only if a closure alert > has occurred in the protocol, i.e. if the connection has been closed > cleanly. Note that in this case

Re: [HACKERS] Create subscription with `create_slot=false` and incorrect slot name

2017-05-22 Thread Euler Taveira
2017-05-22 17:52 GMT-03:00 Dmitry Dolgov <9erthali...@gmail.com>: > Maybe this question was already raised before, but I couldn't find a > discussion. When I'm creating a subscription with `create_slot=false` looks > like it's possible to pass a slot name with invalid characters. In this >

Re: [HACKERS] Getting server crash after running sqlsmith

2017-05-22 Thread tushar
On 03/29/2017 12:06 AM, Tom Lane wrote: Hm ... I don't see a crash here, but I wonder whether you have parameters set that would cause this query to be run as a parallel query? Because pg_rotate_logfile() is marked as parallel-safe in pg_proc, which seems probably insane. Well, I am able to see

[HACKERS] Error-like LOG when connecting with SSL for password authentication

2017-05-22 Thread Michael Paquier
Hi all, When attempting to connect using password authentication through SSL, the backend will complain in its log with the following entry before calling sendAuthRequest(), which asks the client for a password: LOG: could not receive data from client: Connection reset by peer After a short

Re: [HACKERS] Fix a typo in hash.c

2017-05-22 Thread Magnus Hagander
On Mon, May 22, 2017 at 3:36 AM, Masahiko Sawada wrote: > Hi, > > Attached patch for $subject. > > s/curent/current/ > > Applied, thanks! //Magnus

Re: [HACKERS] psql - add special variable to reflect the last query status

2017-05-22 Thread Fabien COELHO
Hello Pavel, After some discussions about what could be useful since psql scripts now accepts tests, this patch sets a few variables which can be used by psql after a "front door" (i.e. actually typed by the user) query: - RESULT_STATUS: the status of the query - ERROR: whether the query

Re: [HACKERS] Default Partition for Range

2017-05-22 Thread Ashutosh Bapat
On Mon, May 22, 2017 at 7:27 AM, Beena Emerson wrote: > Hello, > > Many were in favour of the default partition for tables partitioned by range > [1]. > Please find attached the WIP patch for the same which can be applied over > the default_partition_v12.patch. > >

Re: [HACKERS] Partition-wise join for join between (declaratively) partitioned tables

2017-05-22 Thread Ashutosh Bapat
On Sat, Apr 29, 2017 at 12:37 AM, Robert Haas wrote: > On Fri, Apr 28, 2017 at 1:18 AM, Ashutosh Bapat > wrote: >> For two-way join this works and is fairly straight-forward. I am >> assuming that A an B are base relations and not joins.

Re: [HACKERS] pg_dump ignoring information_schema tables which used in Create Publication.

2017-05-22 Thread tushar
On 05/22/2017 05:31 PM, Tom Lane wrote: Do we have a prohibition against publishing/subscribing anything in pg_catalog? Yes. postgres=# create publication pub for table pg_catalog.pg_AM; ERROR: "pg_am" is a system table DETAIL: System tables cannot be added to publications. postgres=# --

Re: [HACKERS] pg_dump ignoring information_schema tables which used in Create Publication.

2017-05-22 Thread Kuntal Ghosh
On Mon, May 22, 2017 at 5:22 PM, tushar wrote: > On 05/22/2017 05:12 PM, Kuntal Ghosh wrote: >> >> pg_dump ignores anything created under object name "pg_*" or >> "information_schema". > > In this below scenario , I am able to see - pg_dump catch the information >

Re: [HACKERS] Increasing parallel workers at runtime

2017-05-22 Thread Kuntal Ghosh
On Mon, May 22, 2017 at 2:54 PM, Rafia Sabih wrote: > On Wed, May 17, 2017 at 2:57 PM, Amit Kapila wrote: >> On Tue, May 16, 2017 at 2:14 PM, Ashutosh Bapat >> wrote: >>> On Mon, May 15, 2017 at 9:23 PM,

Re: [HACKERS] pg_dump ignoring information_schema tables which used in Create Publication.

2017-05-22 Thread Tom Lane
tushar writes: > On 05/22/2017 05:12 PM, Kuntal Ghosh wrote: >> pg_dump ignores anything created under object name "pg_*" or >> "information_schema". > In this below scenario , I am able to see - pg_dump catch the > information of table which is created under

[HACKERS] wal_level > WAL_LEVEL_LOGICAL

2017-05-22 Thread Neha Khatri
As per my understabding, current postgres server supports only three values for wal_level i.e. 'minimal' , 'replica' or 'logical'. But following error message brought to notice that there are various code spots that try to look for wal_level >= WAL_LEVEL_LOGICAL: select * from

Re: [HACKERS] pg_dump ignoring information_schema tables which used in Create Publication.

2017-05-22 Thread Kuntal Ghosh
Hello, pg_dump ignores anything created under object name "pg_*" or "information_schema". I guess you will not have any "CREATE TABLE" definition as well for information_schema.abc. Related code: else if (strncmp(nsinfo->dobj.name, "pg_", 3) == 0 || strcmp(nsinfo->dobj.name,

Re: [HACKERS] pg_dump ignoring information_schema tables which used in Create Publication.

2017-05-22 Thread tushar
On 05/22/2017 05:12 PM, Kuntal Ghosh wrote: pg_dump ignores anything created under object name "pg_*" or "information_schema". In this below scenario , I am able to see - pg_dump catch the information of table which is created under information_schema postgres=# create database ntest;

[HACKERS] PostgreSQL 10beta1 / OpenBSD : compilation failed with libxml

2017-05-22 Thread Pierre-Emmanuel André
Hi, I still have an issue with OpenBSD -current and PostgreSQL 10beta1. I tried to build it with these options: --with-openssl=/usr --with-perl --with-pam=no --with-uuid=bsd --enable-integer-datetimes --with-system-tzdata=/usr/share/zoneinfo --with-openssl --disable-thread-safety --with-libxml

Re: [HACKERS] PG10 Crash-safe and replicable Hash Indexes and UNIQUE

2017-05-22 Thread Amit Kapila
On Mon, May 22, 2017 at 8:31 AM, Chapman Flack wrote: > On 05/19/17 11:41, Tom Lane wrote: > >> No, nobody's done anything about allowing hash indexes to support >> uniqueness AFAIK. I don't have a clear picture of how much work >> it would be, but it would likely be more

[HACKERS] "create publication..all tables" ignore 'partition not supported' error

2017-05-22 Thread tushar
Hi, I observed that - "create publication..all tables" ignore 'partition not supported' error \\create a partition table You are now connected to database "s" as user "centos". s=# CREATE TABLE measurement ( s(# city_id int not null, s(# logdate date not null, s(#

Re: [HACKERS] [POC] hash partitioning

2017-05-22 Thread amul sul
On Fri, May 19, 2017 at 10:35 PM, Robert Haas wrote: > On Fri, May 19, 2017 at 5:32 AM, amul sul wrote: >> Updated patch attached. 0001-patch rebased against latest head. >> 0002-patch also incorporates code comments and error message changes >> as per

[HACKERS] pg_dump ignoring information_schema tables which used in Create Publication.

2017-05-22 Thread tushar
Hi, pg_dump is ignoring tables which created under information_schema schema for CREATE PUBLICATION . postgres=# create database test; CREATE DATABASE postgres=# \c test You are now connected to database "test" as user "centos". test=# create table information_schema.abc(n int); CREATE

[HACKERS] Index created in BEFORE trigger not updated during INSERT

2017-05-22 Thread Albe Laurenz
Not that it is a useful use case, but I believe that this is a bug that causes index corruption: CREATE TABLE mytable( id integer PRIMARY KEY, id2 integer NOT NULL ); CREATE FUNCTION makeindex() RETURNS trigger LANGUAGE plpgsql AS $$BEGIN CREATE INDEX ON mytable(id2); RETURN NEW;

Re: [HACKERS] Increasing parallel workers at runtime

2017-05-22 Thread Rafia Sabih
On Wed, May 17, 2017 at 2:57 PM, Amit Kapila wrote: > On Tue, May 16, 2017 at 2:14 PM, Ashutosh Bapat > wrote: >> On Mon, May 15, 2017 at 9:23 PM, Robert Haas wrote: >> >> Also, looking at the patch, it doesn't

Re: [HACKERS] "create publication..all tables" ignore 'partition not supported' error

2017-05-22 Thread Kuntal Ghosh
Yeah, it's a bug. While showing the table definition, we use the following query for showing the related publications: "SELECT pub.pubname\n" " FROM pg_catalog.pg_publication pub\n" " LEFT JOIN pg_catalog.pg_publication_rel pr\n"

Re: [HACKERS] PG10 Crash-safe and replicable Hash Indexes and UNIQUE

2017-05-22 Thread Chapman Flack
On 05/22/2017 05:16 AM, Amit Kapila wrote: > Agreed, but even if we have any such syntax, making it work for hash > indexes is tricky, because we currently store the hash code in the > index, not the original hash index key. That was what gave me the idea in the first place, which then I realized

Re: pgindent (was Re: [HACKERS] [COMMITTERS] pgsql: Preventive maintenance in advance of pgindent run.)

2017-05-22 Thread Tom Lane
Piotr Stefaniak writes: > On 2017-05-22 01:50, Tom Lane wrote: >> Being lazy, I just wiped my copy and re-cloned, but it still seems the >> same as before ... last commit on the pass3 branch is from Mar 4. >> What branch should I be paying attention to? > pass3 is

Re: [HACKERS] PostgreSQL 10beta1 / OpenBSD : compilation failed with libxml

2017-05-22 Thread Tom Lane
Pierre-Emmanuel =?iso-8859-15?Q?Andr=E9?= writes: > I still have an issue with OpenBSD -current and PostgreSQL 10beta1. > common.o: In function `psql_get_variable': > common.c:(.text+0x114c): undefined reference to `appendShellStringNoError' > mainloop.o: In function

[HACKERS] plpgsql, caching, resowners and jit

2017-05-22 Thread Andres Freund
Hi, While hacking a bit more on my JIT prototype (so I actually know what I'm talking about at pgcon), I encountered an interesting issue. To keep track of the lifetime of JITed functions it seems natural to add support for that to resowners. Not that hard. After doing so, I got pretty weird

Re: [HACKERS] [BUGS] Concurrent ALTER SEQUENCE RESTART Regression

2017-05-22 Thread Andres Freund
On 2017-05-19 08:31:15 -0400, Robert Haas wrote: > On Thu, May 18, 2017 at 4:54 PM, Andres Freund wrote: > > There's still weird behaviour, unfortunately. If you do an ALTER > > SEQUENCE changing minval/maxval w/ restart in a transaction, and abort, > > you'll a) quite

[HACKERS] pg_upgrade translation

2017-05-22 Thread Alvaro Herrera
Translatability was turned on for pg_upgrade on pg10, but it needs some work. The choices are we fix it now, or we revert the addition of NLS there and we do it for PG11. I think the ugliest one is to change the messages about "the %s server", which are about a dozen -- things like: msgid

Re: [HACKERS] Improve logical decoding error message (was wal_level > WAL_LEVEL_LOGICAL)

2017-05-22 Thread Neha Khatri
On Tue, May 23, 2017 at 10:26 AM, Michael Paquier wrote: > On Tue, May 23, 2017 at 8:08 AM, Neha Khatri > wrote: > > The Logical Decoding example in the documentation says: > > > > "Before you can use logical decoding, you must set wal_level

Re: [HACKERS] Some thoughts about SCRAM implementation

2017-05-22 Thread Michael Paquier
On Mon, Apr 10, 2017 at 6:39 PM, Álvaro Hernández Tortosa wrote: > - I think channel binding support should be added. SCRAM brings security > improvements over md5 and other simpler digest algorithms. But where it > really shines is together with channel binding. This is the only

Re: [HACKERS] PostgreSQL 10beta1 / OpenBSD : compilation failed with libxml

2017-05-22 Thread Pierre-Emmanuel André
On Mon, May 22, 2017 at 10:36:41AM -0400, Tom Lane wrote: > Pierre-Emmanuel =?iso-8859-15?Q?Andr=E9?= writes: > > I still have an issue with OpenBSD -current and PostgreSQL 10beta1. > > > common.o: In function `psql_get_variable': > > common.c:(.text+0x114c): undefined