Re: [HACKERS] ToDo: API for SQL statement execution other than SPI

2016-06-28 Thread Craig Ringer
On 29 June 2016 at 13:55, Pavel Stehule wrote: > Hi > > I am writing two background workers - autoreindex and scheduler. In Both I > need to execute queries from top level. I had to wrote redundant code > https://github.com/okbob/autoreindex/blob/master/utils.c > autoreindex_execute_sql_command

Re: [HACKERS] Rename max_parallel_degree?

2016-06-28 Thread Amit Kapila
On Wed, Jun 29, 2016 at 11:54 AM, Julien Rouhaud wrote: > Or should we allow setting it to -1 for instance to disable the limit? > By disabling the limit, do you mean to say that only max_parallel_workers_per_gather will determine the workers required or something else? If earlier, then I am not

Re: [HACKERS] Rename max_parallel_degree?

2016-06-28 Thread Julien Rouhaud
On 29/06/2016 06:29, Amit Kapila wrote: > On Wed, Jun 29, 2016 at 2:57 AM, Julien Rouhaud > wrote: >> >> Thanks a lot for the help! >> >> PFA v6 which should fix all the issues mentioned. > > Couple of minor suggestions. > > - . Note that the requested > + , limited by > +

Re: [HACKERS] Gin index on array of uuid

2016-06-28 Thread Oleg Bartunov
On Wed, Jun 29, 2016 at 6:17 AM, M Enrique wrote: > What's a good source code entry point to review how this is working for > anyarray currently? I am new to the postgres code. I spend some time > looking for it but all I found is the following (which I have not been able > to decipher yet). > L

Re: [HACKERS] make clean didn't clean up files generated from *.(y|l)

2016-06-28 Thread Kouhei Kaigai
> Kouhei Kaigai writes: > > I tried to build the latest master branch just after the switch from > > REL9_5_STABLE and "make clean", however, repl_gram.c was not cleaned > > up correctly. So, my problem is that repl_gram.l was the latest version, > > but compiler saw the repl_gram.c generated base

[HACKERS] ToDo: API for SQL statement execution other than SPI

2016-06-28 Thread Pavel Stehule
Hi I am writing two background workers - autoreindex and scheduler. In Both I need to execute queries from top level. I had to wrote redundant code https://github.com/okbob/autoreindex/blob/master/utils.c autoreindex_execute_sql_command .Same code is in pglogical. Some statements - like VACUUM or

Re: [HACKERS] Reviewing freeze map code

2016-06-28 Thread Masahiko Sawada
On Fri, Jun 24, 2016 at 11:04 AM, Amit Kapila wrote: > On Fri, Jun 24, 2016 at 4:33 AM, Andres Freund wrote: >> On 2016-06-23 18:59:57 -0400, Alvaro Herrera wrote: >>> Andres Freund wrote: >>> >>> > I'm looking into three approaches right now: >>> > >>> > 3) Use WAL logging for the already_marked

Re: [HACKERS] Documentation fixes for pg_visibility

2016-06-28 Thread Michael Paquier
On Tue, Jun 28, 2016 at 7:05 AM, Robert Haas wrote: > On Mon, Jun 27, 2016 at 5:56 PM, Michael Paquier > wrote: >>> Under what circumstances would you wish to check only one page of a >>> relation? >> >> What I'd like to be able to do is to stop scanning the relation once >> one defective tuple

Re: [HACKERS] Postgres_fdw join pushdown - wrong results with whole-row reference

2016-06-28 Thread Ashutosh Bapat
On Tue, Jun 28, 2016 at 12:52 PM, Etsuro Fujita wrote: > On 2016/06/28 15:23, Ashutosh Bapat wrote: > >> The wording "column "whole-row reference ..." doesn't look good. >> Whole-row reference is not a column. The error context itself should be >> "whole row reference for foreign table ft1". >> >

Re: [HACKERS] make clean didn't clean up files generated from *.(y|l)

2016-06-28 Thread Tom Lane
Kouhei Kaigai writes: > I tried to build the latest master branch just after the switch from > REL9_5_STABLE and "make clean", however, repl_gram.c was not cleaned > up correctly. So, my problem is that repl_gram.l was the latest version, > but compiler saw the repl_gram.c generated based on the v

Re: [HACKERS] Rename max_parallel_degree?

2016-06-28 Thread Amit Kapila
On Wed, Jun 29, 2016 at 2:57 AM, Julien Rouhaud wrote: > > Thanks a lot for the help! > > PFA v6 which should fix all the issues mentioned. Couple of minor suggestions. - . Note that the requested + , limited by + . Note that the requested Typo. /linked/linkend You ca

[HACKERS] make clean didn't clean up files generated from *.(y|l)

2016-06-28 Thread Kouhei Kaigai
Hello, I got the build error below. It concerns RESERVE_WAL is not defined, however, it should not be a problem to be oversight for a long time. I tried to build the latest master branch just after the switch from REL9_5_STABLE and "make clean", however, repl_gram.c was not cleaned up correctly.

Re: [HACKERS] primary_conninfo missing from pg_stat_wal_receiver

2016-06-28 Thread Michael Paquier
On Wed, Jun 29, 2016 at 12:23 PM, Alvaro Herrera wrote: > Michael Paquier wrote: >> On Wed, Jun 29, 2016 at 6:42 AM, Alvaro Herrera >> wrote: > >> > I have already edited the patch following some of these ideas. Will >> > post a new version later. >> >> Cool, thanks. > > Here it is. I found it

Re: [HACKERS] How to kill a Background worker and Its metadata

2016-06-28 Thread Craig Ringer
On 28 June 2016 at 08:28, Akash Agrawal wrote: > I've handled SIGTERM signal. pg_terminate_backend send signals (SIGTERM) > to backend processes identified by process ID. And also, after this call I > am able to track in my logs that the background worker gets terminated. > > Yet, I am only able

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-28 Thread Rushabh Lathia
Thanks Tom. I performed testing with the latest commit and test are running fine. On Tue, Jun 28, 2016 at 8:14 PM, Tom Lane wrote: > Rushabh Lathia writes: > > SELECT setval('s', max(100)) from tab; > > ERROR: ORDER/GROUP BY expression not found in targetlist > > Fixed, thanks for the report!

Re: [HACKERS] primary_conninfo missing from pg_stat_wal_receiver

2016-06-28 Thread Alvaro Herrera
Michael Paquier wrote: > On Wed, Jun 29, 2016 at 6:42 AM, Alvaro Herrera > wrote: > > I have already edited the patch following some of these ideas. Will > > post a new version later. > > Cool, thanks. Here it is. I found it was annoying to maintain the function return tupdesc in two places (

Re: [HACKERS] Gin index on array of uuid

2016-06-28 Thread M Enrique
What's a good source code entry point to review how this is working for anyarray currently? I am new to the postgres code. I spend some time looking for it but all I found is the following (which I have not been able to decipher yet). [image: pasted1] Thank you, Enrique On Tue, Jun 21, 2016 at

[HACKERS] dumping database privileges broken in 9.6

2016-06-28 Thread Peter Eisentraut
Do this: CREATE DATABASE test1; REVOKE CONNECT ON DATABASE test1 FROM PUBLIC; Run pg_dumpall. In 9.5, this produces CREATE DATABASE test1 WITH TEMPLATE = template0 OWNER = peter; REVOKE ALL ON DATABASE test1 FROM PUBLIC; REVOKE ALL ON DATABASE test1 FROM peter; GRANT ALL ON DATABASE test1 TO p

Re: [HACKERS] parallel workers and client encoding

2016-06-28 Thread Peter Eisentraut
On 6/27/16 5:37 PM, Robert Haas wrote: Please find attached an a patch for a proposed alternative approach. This does the following: 1. When the client_encoding GUC is changed in the worker, SetClientEncoding() is not called. I think this could be a problem, because then the client encoding in

Re: [HACKERS] primary_conninfo missing from pg_stat_wal_receiver

2016-06-28 Thread Michael Paquier
On Wed, Jun 29, 2016 at 6:42 AM, Alvaro Herrera wrote: > Michael Paquier wrote: > >> I have been thinking more about that, and came up with the following >> idea... We do not want to link libpq directly to the server, so let's >> add a new routine to libpqwalreceiver that builds an obfuscated >> c

[HACKERS] Forthcoming SQL standards about JSON and Multi-Dimensional Arrays (FYI)

2016-06-28 Thread Stefan Keller
Hi, FYI: I'd just like to point you to following two forthcoming standard parts from "ISO/IEC JTS 1/SC 32" comittee: one on JSON, and one on "Multi-Dimensional Arrays" (SQL/MDA). They define there some things different as already in PG. See also Peter Baumann's slides [1] and e.g. [2] :Stefan [

Re: [HACKERS] primary_conninfo missing from pg_stat_wal_receiver

2016-06-28 Thread Alvaro Herrera
Michael Paquier wrote: > I have been thinking more about that, and came up with the following > idea... We do not want to link libpq directly to the server, so let's > add a new routine to libpqwalreceiver that builds an obfuscated > connection string and let's have walreceiver.c save it in shared

[HACKERS] Re: Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-28 Thread Oleg Bartunov
On Tue, Jun 28, 2016 at 7:00 PM, Oleg Bartunov wrote: > On Tue, Jun 28, 2016 at 9:32 AM, Noah Misch wrote: >> On Sun, Jun 26, 2016 at 10:22:26PM -0400, Noah Misch wrote: >>> On Wed, Jun 15, 2016 at 11:08:54AM -0400, Noah Misch wrote: >>> > On Wed, Jun 15, 2016 at 03:02:15PM +0300, Teodor Sigaev w

Re: [HACKERS] Rename max_parallel_degree?

2016-06-28 Thread Julien Rouhaud
On 28/06/2016 04:44, Amit Kapila wrote: > On Mon, Jun 27, 2016 at 10:35 PM, Julien Rouhaud >> >> There's already a pg_memory_barrier() call in >> BackgroundWorkerStateChange(), to avoid reordering the notify_pid load. >> Couldn't we use it to also make sure the parallel_terminate_count >> increment

Re: [HACKERS] IPv6 link-local addresses and init data type

2016-06-28 Thread Markus Wanner
Haribabu, On 07.06.2016 07:19, Haribabu Kommi wrote: >> I have not looked at the spec, but I wouldn't be surprised if there >> were an upper limit on the length of valid scope names. Yeah, I didn't find any upper limit, either. > I am not able to find any link that suggests the maximum length of

Re: [HACKERS] seg fault on dsm_create call

2016-06-28 Thread Robert Haas
On Tue, Jun 28, 2016 at 12:45 PM, Max Fomichev wrote: > On 28/06/16 19:24, Robert Haas wrote: > Thanks. > It works now with CurrentResourceOwner = ResourceOwnerCreate(NULL, "name of > my extension") > > I am a little bit confused about test/modules/test_shm_mq, where > CurrentResourceOwner is set

Re: [HACKERS] An unkillable connection caused replication delay on my replica

2016-06-28 Thread Alvaro Herrera
Shawn wrote: > strace of long-running query pid 6819 loops like this: > > sendto(10, "" NULL, 0) = ? ERESTARTSYS (To be > restarted if SA_RESTART is set) > --- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=8719, > si_uid=3001} --- > rt_sigreturn() > > Where pid 6819 is

Re: [HACKERS] Questionabl description in datatype.sgml

2016-06-28 Thread Bruce Momjian
On Fri, Jun 24, 2016 at 07:27:24AM +0900, Tatsuo Ishii wrote: > > On Sat, Jun 18, 2016 at 11:58:58AM -0400, Tom Lane wrote: > >> Tatsuo Ishii writes: > >> > In "8.13.2. Encoding Handling" > >> > > >> > When using binary mode to pass query parameters to the server > >> > and query resul

Re: [HACKERS] Reference to UT1

2016-06-28 Thread Bruce Momjian
On Wed, Jun 22, 2016 at 04:51:46PM -0400, Bruce Momjian wrote: > On Mon, Jun 6, 2016 at 03:53:41PM +1200, Thomas Munro wrote: > > Hi > > > > The manual[1] says "Technically,PostgreSQL uses UT1 rather than UTC > > because leap seconds are not handled." I'm certainly no expert on > > this stuff bu

Re: [HACKERS] primary_conninfo missing from pg_stat_wal_receiver

2016-06-28 Thread Alvaro Herrera
Stephen Frost wrote: > * Tom Lane (t...@sss.pgh.pa.us) wrote: > > Michael Paquier writes: > > > On Tue, Jun 21, 2016 at 11:29 AM, Tom Lane wrote: > > >> What I would want to know is whether this specific change is actually a > > >> good idea. In particular, I'm concerned about the possible secur

Re: [HACKERS] seg fault on dsm_create call

2016-06-28 Thread Max Fomichev
On 28/06/16 19:24, Robert Haas wrote: On Tue, Jun 28, 2016 at 10:11 AM, Max Fomichev wrote: Hello, sorry for my repost from psql-novice, probably it was not a right place for my question. I'm trying to understand how to work with dynamic shared memory, message queues and workers. The problem i

Re: [HACKERS] primary_conninfo missing from pg_stat_wal_receiver

2016-06-28 Thread Alvaro Herrera
Noah Misch wrote: > On Sun, Jun 19, 2016 at 05:56:12PM +0900, Michael Paquier wrote: > > The new pg_stat_wal_receiver does not include primary_conninfo. > > Looking at that now, it looks almost stupid not to include it... > > Adding it now would require a catalog bump, so I am not sure if this > >

[HACKERS] seg fault on dsm_create call

2016-06-28 Thread Max Fomichev
Some debug info related to my previous post - * thread #1: tid = 0x2601e9, 0x000100313e5e postgres`ResourceOwnerEnlargeDSMs + 10, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x130) * frame #0: 0x000100313e5e postgres`ResourceOwnerEnlargeDSMs + 10

Re: [HACKERS] seg fault on dsm_create call

2016-06-28 Thread Robert Haas
On Tue, Jun 28, 2016 at 10:11 AM, Max Fomichev wrote: > Hello, > sorry for my repost from psql-novice, probably it was not a right place for > my question. > > I'm trying to understand how to work with dynamic shared memory, message > queues and workers. > The problem is I can not initialize any d

[HACKERS] Re: Should phraseto_tsquery('simple', 'blue blue') @@ to_tsvector('simple', 'blue') be true ?

2016-06-28 Thread Oleg Bartunov
On Tue, Jun 28, 2016 at 9:32 AM, Noah Misch wrote: > On Sun, Jun 26, 2016 at 10:22:26PM -0400, Noah Misch wrote: >> On Wed, Jun 15, 2016 at 11:08:54AM -0400, Noah Misch wrote: >> > On Wed, Jun 15, 2016 at 03:02:15PM +0300, Teodor Sigaev wrote: >> > > On Wed, Jun 15, 2016 at 02:54:33AM -0400, Noah

Re: [HACKERS] [HITB-Announce] HITB2016AMS Videos & GSEC Singapore Voting

2016-06-28 Thread Alvaro Herrera
Robert Haas wrote: > On Mon, Jun 27, 2016 at 5:29 PM, Alvaro Herrera > wrote: > > Robert Haas wrote: > >> On Mon, Jun 20, 2016 at 5:41 PM, Hafez Kamal > >> wrote: > >> > See you in Singapore! > >> > >> This seems totally off-topic. Shouldn't a post like this result in a ban? > > > > It is off-t

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-28 Thread Tom Lane
Rushabh Lathia writes: > SELECT setval('s', max(100)) from tab; > ERROR: ORDER/GROUP BY expression not found in targetlist Fixed, thanks for the report! regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your sub

Re: [HACKERS] Reviewing freeze map code

2016-06-28 Thread Masahiko Sawada
On Tue, Jun 28, 2016 at 8:06 PM, Masahiko Sawada wrote: > On Tue, Jun 21, 2016 at 6:59 AM, Andres Freund wrote: >> On 2016-06-20 17:55:19 -0400, Robert Haas wrote: >>> On Mon, Jun 20, 2016 at 4:24 PM, Andres Freund wrote: >>> > On 2016-06-20 16:10:23 -0400, Robert Haas wrote: >>> >> What exactly

[HACKERS] seg fault on dsm_create call

2016-06-28 Thread Max Fomichev
Hello, sorry for my repost from psql-novice, probably it was not a right place for my question. I'm trying to understand how to work with dynamic shared memory, message queues and workers. The problem is I can not initialize any dsm segment - void _PG_init() { ... dsm_seg

Re: [HACKERS] ERROR: ORDER/GROUP BY expression not found in targetlist

2016-06-28 Thread Amit Langote
On Tue, Jun 28, 2016 at 2:52 PM, Rushabh Lathia wrote: > Hi, > > Consider the below testcase: > > CREATE TABLE tab( > c1 INT NOT NULL, > c2 INT NOT NULL > ); > INSERT INTO tab VALUES (1, 2); > INSERT INTO tab VALUES (2, 1); > INSERT INTO tab VALUES (1, 2); > > > case 1: > > SELECT c.c1, c.c2 f

Re: [HACKERS] How to kill a Background worker and Its metadata

2016-06-28 Thread Akash Agrawal
I am calling proc_exit(1) once the worker encounters SIGTERM signal. I've attached my code here. Here is the link to stackoverflow: http://stackoverflow.com/questions/38058628/how-to-kill-a-background-worker-including-its-metadata-in-postgres On Mon, Jun 27, 2016 at 8:41 PM, Craig Ringer wrote

Re: [HACKERS] How to kill a Background worker and Its metadata

2016-06-28 Thread Akash Agrawal
I've handled SIGTERM signal. pg_terminate_backend send signals (SIGTERM) to backend processes identified by process ID. And also, after this call I am able to track in my logs that the background worker gets terminated. Yet, I am only able to register first 8 background workers. I am using select

Re: [HACKERS] Postgres_fdw join pushdown - wrong results with whole-row reference

2016-06-28 Thread Ashutosh Bapat
> > > > > postgres_fdw resets the search path to pg_catalog while opening > connection > > to the server. The reason behind this is explained in deparse.c > > > > * We assume that the remote session's search_path is exactly > "pg_catalog", > > * and thus we need schema-qualify all and only names

Re: [HACKERS] fixing subplan/subquery confusion

2016-06-28 Thread Amit Kapila
On Tue, Jun 28, 2016 at 8:25 AM, Tom Lane wrote: > Amit Kapila writes: >> I had couple of questions [1] related to that patch. See if you find >> those as relevant? > > I do not think those cases are directly relevant: you're talking about > appendrels not single, unflattened RTE_SUBQUERY rels.

Re: [HACKERS] Reviewing freeze map code

2016-06-28 Thread Masahiko Sawada
On Tue, Jun 21, 2016 at 6:59 AM, Andres Freund wrote: > On 2016-06-20 17:55:19 -0400, Robert Haas wrote: >> On Mon, Jun 20, 2016 at 4:24 PM, Andres Freund wrote: >> > On 2016-06-20 16:10:23 -0400, Robert Haas wrote: >> >> What exactly is the point of all of that already_marked stuff? >> > >> > Pr

Re: [HACKERS] Improving executor performance

2016-06-28 Thread Rajeev rastogi
On 25 June 2016 05:00, Andres Freund Wrote: >To: pgsql-hackers@postgresql.org >Subject: [HACKERS] Improving executor performance > >My observations about the performance bottlenecks I found, and partially >addressed, are in rough order of importance (there's interdependence >between most of them):

Re: [HACKERS] Patch to implement pg_current_logfile() function

2016-06-28 Thread Gilles Darold
Le 07/04/2016 08:30, Karl O. Pinc a écrit : > On Thu, 7 Apr 2016 01:13:51 -0500 > "Karl O. Pinc" wrote: > >> On Wed, 6 Apr 2016 23:37:09 -0500 >> "Karl O. Pinc" wrote: >> >>> On Wed, 6 Apr 2016 22:26:13 -0500 >>> "Karl O. Pinc" wrote: On Wed, 23 Mar 2016 23:22:26 +0100 Gilles Darold

Re: [HACKERS] Postgres_fdw join pushdown - wrong results with whole-row reference

2016-06-28 Thread Etsuro Fujita
On 2016/06/28 15:23, Ashutosh Bapat wrote: The wording "column "whole-row reference ..." doesn't look good. Whole-row reference is not a column. The error context itself should be "whole row reference for foreign table ft1". Ah, you are right. Please find attached an updated version. Best reg