Re: using pg_basebackup for point in time recovery

2018-06-20 Thread Ron
On 06/21/2018 12:27 AM, Michael Paquier wrote: [snip] Attached is a patch which includes your suggestion. What do you think? As that's an improvement, only HEAD would get that clarification. You've *got* to be kidding. Fixing an ambiguously or poorly worded bit of *documentation* should obvi

Re: using pg_basebackup for point in time recovery

2018-06-20 Thread Michael Paquier
Hi Pierre, On Wed, Jun 20, 2018 at 08:06:31AM +, Pierre Timmermans wrote: > Hi Michael You should avoid top-posting on the Postgres lists, this is not the usual style used by people around :) > Thanks for the confirmation. Your rewording removes the confusion. I > would maybe take the opport

Re: Using DSN Connection and knowing windows username

2018-06-20 Thread Łukasz Jarych
Thank you Adrian, In the meantime just an idea, but could you capture the system user in a > table in Access and use that to pass on to Postgres? Brilliant ! simple and genious! The purpose of it is to have history log table with DML and DDL changes using triggers. Best, Luke 2018-06-21 0:

Re: SQL Query never ending...

2018-06-20 Thread David G. Johnston
On Wed, Jun 20, 2018 at 3:34 PM, Fabrízio de Royes Mello < fabri...@timbira.com.br> wrote: > And use some external service like pastebin.com to send long SQL > statements. > ​Or just attach a text file - those are allowed on these lists. ​ David J.

Re: SQL Query never ending...

2018-06-20 Thread Fabrízio de Royes Mello
2018-06-20 18:35 GMT-03:00 DiasCosta : > > Hi all, > can someone help me? > > I don't know if this is the correct list for this matter. If I'm wrong, please bear with me and point me in right direction. > Here is a good start... > I have a large query which, largely after more than 24 hours run

Re: Using DSN Connection and knowing windows username

2018-06-20 Thread Adrian Klaver
On 06/20/2018 07:06 AM, Łukasz Jarych wrote: David G, thank you. Can you confirm if i am thinking correctly ? So I can set up authetification to know which user is logged on and use this as postgresql user? Only if the system user is a postgres user or can be mapped to one: https://www.post

SQL Query never ending...

2018-06-20 Thread DiasCosta
Hi all, can someone help me? I don't know if this is the correct list for this matter. If I'm wrong, please bear with me and point me in right direction. I have a large query which, largely after more than 24 hours running, doesn't come to an end; However I can see, using system tools, that

Re: Suggestion about logging only every n-th statement

2018-06-20 Thread Adrien Nayrat
On 06/20/2018 03:08 PM, Andreas Kretschmer wrote: > I would suggest using of pg_stat_statements for that. I agree, but sometimes it is not sufficient. For example, if you need query's parameters. -- Adrien NAYRAT signature.asc Description: OpenPGP digital signature

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread David G. Johnston
On Wed, Jun 20, 2018 at 1:02 PM, Alvaro Herrera wrote: > On 2018-Jun-20, Igor Korot wrote: > > > [quote] > > In order to create an event trigger, you must first create a function > > with the special return type event_trigger. This function need not > > (and may not) return a value; the return ty

Re: Postgres 10.4 crashing when using PLV8

2018-06-20 Thread Mukesh Chhatani
Thanks David for the response, I have opened a issue with PLV8 team. Let me know if I should report this bug to postgres or not, since I was not sure thus I sent email earlier. Regards, Mukesh On Wed, Jun 20, 2018 at 3:02 PM, David G. Johnston < david.g.johns...@gmail.com> wrote: > On Wed, Jun

Re: Can PostgreSQL create new WAL files instead of reusing old ones?

2018-06-20 Thread Jerry Jelinek
As Dave described in his original email on this topic, we'd like to avoid recycling WAL files since that can cause performance issues when we have a read-modify-write on a file that has dropped out of the cache. I have implemented a small change to allow WAL recycling to be disabled. It is visible

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread Alvaro Herrera
On 2018-Jun-20, Igor Korot wrote: > [quote] > In order to create an event trigger, you must first create a function > with the special return type event_trigger. This function need not > (and may not) return a value; the return type serves merely as a > signal that the function is to be invoked as

Re: Postgres 10.4 crashing when using PLV8

2018-06-20 Thread David G. Johnston
On Wed, Jun 20, 2018 at 12:46 PM, Mukesh Chhatani wrote: > I am trying to use the PLV8 via function and while using the function > created via PLV8 in one of the create materialized view, postgres crashes, > attached is the log file with DEBUG5 turned on. > ​These are not the correct place to po

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread Igor Korot
Hi, Francisco, On Wed, Jun 20, 2018 at 12:22 PM, Francisco Olarte wrote: > Igor: > > On Wed, Jun 20, 2018 at 7:07 PM, Igor Korot wrote: >> Just one more question: >> This page https://www.postgresql.org/docs/current/static/xfunc-c.html#DFUNC >> does not reference >> Windows/MSVC/MinGW as a way t

Postgres 10.4 crashing when using PLV8

2018-06-20 Thread Mukesh Chhatani
Hello Team, I am trying to use the PLV8 via function and while using the function created via PLV8 in one of the create materialized view, postgres crashes, attached is the log file with DEBUG5 turned on. SQL which is breaking the code and SQL function is attached. Creating materialized view - m

Re: Is postorder tree traversal possible with recursive CTE's?

2018-06-20 Thread Hellmuth Vargas
Hi It may not be the most elegant solution butworks! with recursive pizza (name, step, ingredient, quantity, unit, rel_qty, path, weight) as ( select name, step, ingredient, quantity, unit , quantity::numeric(10,2) , step::text ,

Trouble matching a nested value in JSONB entries

2018-06-20 Thread Enrico Thierbach
Hi list, I have some trouble matching a value in a JSONB object against multiple potential matches. Lets say, I have a table with an id, and a metadata JSONB column, which holds data like the following 1 | {"group_id": 1} 2 | {“group_id": 1} 3 | {“group_id": 2} 4 | {“group_i

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread Melvin Davidson
On Wed, Jun 20, 2018 at 1:28 PM, Francisco Olarte wrote: > Melvin: > > Maybe old eyes, but ... > > On Wed, Jun 20, 2018 at 7:03 PM, Melvin Davidson > wrote: > >>Is there a way to be notified on the CREATE TABLE execution? > > Here is sample code that will notify for a CREATE or DROP table: > > D

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread Francisco Olarte
Melvin: Maybe old eyes, but ... On Wed, Jun 20, 2018 at 7:03 PM, Melvin Davidson wrote: >>Is there a way to be notified on the CREATE TABLE execution? > Here is sample code that will notify for a CREATE or DROP table: Doesn't this trigger just log the events? I think it's missing something like

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread Francisco Olarte
Igor: On Wed, Jun 20, 2018 at 7:07 PM, Igor Korot wrote: > Just one more question: > This page https://www.postgresql.org/docs/current/static/xfunc-c.html#DFUNC > does not reference > Windows/MSVC/MinGW as a way to compile the code. Sorry, I don't do windows. You do not need C extension functio

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread Igor Korot
Thx, Francisco. It makes sense now. Just one more question: This page https://www.postgresql.org/docs/current/static/xfunc-c.html#DFUNC does not reference Windows/MSVC/MinGW as a way to compile the code. How should I do it? Thx. On Wed, Jun 20, 2018 at 11:44 AM, Francisco Olarte wrote: > On

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread Melvin Davidson
>Is there a way to be notified on the CREATE TABLE execution? Here is sample code that will notify for a CREATE or DROP table: CREATE TABLE public.tbl_create_log ( tbl_cl_key bigint NOT NULL DEFAULT nextval('tbl_create_log_tbl_cl_key_seq'::regclass), tbl_cre8_time timestamp without time zone

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread Francisco Olarte
On Wed, Jun 20, 2018 at 5:20 PM, Igor Korot wrote: >> https://www.postgresql.org/docs/10/static/sql-createeventtrigger.html >> Your scenario suggests you may wish to avail yourself of the Listen and >> Notify commands as well. > > I did look at the Listen/Notify. > Unfortunately the listening is

Re: Is postorder tree traversal possible with recursive CTE's?

2018-06-20 Thread Alban Hertroys
On 19 June 2018 at 21:14, Hellmuth Vargas wrote: > > Hi > > with partial sum: > > with recursive pizza (name, step, ingredient, quantity, unit, rel_qty, path, > weight) > as ( > select > name, step, ingredient, quantity, unit > , quantity::numeric(10,2) >

Re: tsvector field length limitation

2018-06-20 Thread Jonathan Marks
What if we just didn’t use positional arguments at all? I.e. we just populate the tsvector with lexemes only? > On Jun 20, 2018, at 10:49 AM, Tom Lane wrote: > > Jonathan Marks writes: >> ... we run into the max tsvector length requirement "The length of a >> tsvector (lexemes + positions) mu

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread Igor Korot
Hi, David, On Tue, Jun 19, 2018 at 5:13 PM, David G. Johnston wrote: > On Tuesday, June 19, 2018, Igor Korot wrote: >> >> Hi, ALL, >> Consider a scenario: >> >> 1. A software that uses libpq is executing. >> 2. Someone opens up a terminal and creates a table. >> 3. A software needs to know about

Re: tsvector field length limitation

2018-06-20 Thread Tom Lane
Jonathan Marks writes: > ... we run into the max tsvector length requirement "The length of a tsvector > (lexemes + positions) must be less than 1 megabyte” > Is there any way to disable or increase that limit in Postgres 10.3? No; it's forced by the representation used for tsvector, which stor

Re: Plan output: actual execution time not considering loops?

2018-06-20 Thread Thomas Kellerer
Tom Lane schrieb am 20.06.2018 um 16:03: >> Consider the following execution plan: >> ... >>     ->  Aggregate  (cost=26.87..26.87 rows=1 width=32) (actual >> time=0.012..0.012 rows=1 loops=70) >>   ->  Bitmap Heap Scan on orders o2  (cost=3.45..26.85 rows=8 >> width=8) (actual time=0

tsvector field length limitation

2018-06-20 Thread Jonathan Marks
Hi folks — We utilize Postgres’ full text search system pretty heavily in our team’s operations and often index tens of millions of records with varying lengths of text. In most cases, the text we need to index is pretty short (no more than. hundreds of words) but in rare cases a single record

Re: Using DSN Connection and knowing windows username

2018-06-20 Thread Łukasz Jarych
David G, thank you. Can you confirm if i am thinking correctly ? So I can set up authetification to know which user is logged on and use this as postgresql user? But i think it will be not possible to use DSN connection with this. Best , Luke 2018-06-20 15:34 GMT+02:00 David G. Johnston : > O

Re: Plan output: actual execution time not considering loops?

2018-06-20 Thread Tom Lane
Thomas Kellerer writes: > Consider the following execution plan: > ... >     ->  Aggregate  (cost=26.87..26.87 rows=1 width=32) (actual > time=0.012..0.012 rows=1 loops=70) >   ->  Bitmap Heap Scan on orders o2  (cost=3.45..26.85 rows=8 > width=8) (actual time=0.004..0.008 rows=8 loo

Re: Load data from a csv file without using COPY

2018-06-20 Thread Adrian Klaver
On 06/19/2018 04:20 PM, Ravi Krishna wrote: Thanks all for replying.  I see that I did not explain my requirement in detail.  So let me explain it in detail. 1. Currently we have a legacy app running in DB2/LUW. Application writes to it either via Java program     or uses a custom ETL script

Re: Using DSN Connection and knowing windows username

2018-06-20 Thread David G. Johnston
On Wednesday, June 20, 2018, Łukasz Jarych wrote: > > How to know in postgresql which specific windows user is using database? > You cannot. All the server knows is the specific user credentials it is authenticating. That said you can authenticate those credentials in such a way so that knowing

Re: Suggestion about logging only every n-th statement

2018-06-20 Thread Andreas Kretschmer
On 20 June 2018 13:51:25 CEST, Janning Vygen wrote: >Back in 2009 I made a suggestion which is not implemented yet but would > >still be very valuable and easy to implement in my opinion (not for me >as I am not speaking C): > >https://www.postgresql.org/message-id/flat/200903161426.56662.vygen%4

Re: Suggestion about logging only every n-th statement

2018-06-20 Thread Janning Vygen
Am 20.06.2018 um 14:53 schrieb Adrien NAYRAT: On 06/20/2018 01:51 PM, Janning Vygen wrote: Back in 2009 I made a suggestion which is not implemented yet but would still be very valuable and easy to implement in my opinion (not for me as I am not speaking C): https://www.postgresql.org/message

Re: Suggestion about logging only every n-th statement

2018-06-20 Thread Adrien NAYRAT
On 06/20/2018 01:51 PM, Janning Vygen wrote: Back in 2009 I made a suggestion which is not implemented yet but would still be very valuable and easy to implement in my opinion (not for me as I am not speaking C): https://www.postgresql.org/message-id/flat/200903161426.56662.vygen%40kicktipp.de

Re: Suggestion about logging only every n-th statement

2018-06-20 Thread Geoff Winkless
On Wed, 20 Jun 2018 at 12:51, Janning Vygen wrote: > But for analyzing usage patterns it would be very nice to have this > combined with a sample_rate for logging. > >logging_sample_rate = n > > So each n-th statement will get logged regardless of execution time. > I think you would need to

Using DSN Connection and knowing windows username

2018-06-20 Thread Łukasz Jarych
Hi, i am using windows server 2012 and connecting from Access FE to Postgresql using DSN connection. When i am using "select current_user;" in postgresql i have always user "postgres" because it is my default user for database. How to know in postgresql which specific windows user is using datab

Suggestion about logging only every n-th statement

2018-06-20 Thread Janning Vygen
Back in 2009 I made a suggestion which is not implemented yet but would still be very valuable and easy to implement in my opinion (not for me as I am not speaking C): https://www.postgresql.org/message-id/flat/200903161426.56662.vygen%40kicktipp.de#200903161426.56662.vy...@kicktipp.de We stil

Plan output: actual execution time not considering loops?

2018-06-20 Thread Thomas Kellerer
Consider the following execution plan: Seq Scan on orders o1  (cost=0.00..18818840.86 rows=3500 width=16) (actual time=0.033..8625.104 rows=99906 loops=1)   Filter: (amount = (SubPlan 1))   Rows Removed by Filter: 600094   Buffers: shared hit=7719778   SubPlan 1     ->  Aggregate  (cost=26.87..26

Re: PostgreSQL Volume Question

2018-06-20 Thread Thomas Kellerer
Data Ace schrieb am 15.06.2018 um 18:26: > Well I think my question is somewhat away from my intention cause of > my poor understanding and questioning :( > > Actually, I have 1TB data and have hardware spec enough to handle > this amount of data, but the problem is that it needs too many join > o

Re: using pg_basebackup for point in time recovery

2018-06-20 Thread Pierre Timmermans
Hi Michael Thanks for the confirmation. Your rewording removes the confusion. I would maybe take the opportunity to re-instate that pg_dump cannot be used for PITR, so in the line of "These are backups that could be used for point-in-time recovery if combined with a WAL archive able to recover up

Re: Is there a way to be notified on the CREATE TABLE execution?

2018-06-20 Thread Pierre Timmermans
I believe you could use an event trigger in postgres to capture the fact that a table was created:  https://www.postgresql.org/docs/current/static/event-triggers.html In the trigger you would then have to code whatever is needed to notify the external software (via a REST call or by posting somet