Re: shared_buffers 8GB maximum

2018-02-16 Thread Vitaliy Garnashevich
Not necessarily - it depends on exactly what was changed ... which unfortunately I don't know for certain. Any filesystem call is a kernel transition. That's a Meltdown issue. Meltdown can be avoided by using trampoline functions to call the (real) kernel functions and isolating each trampolin

Re: Database health check/auditing

2018-02-16 Thread Tom Lane
George Neuner writes: > On Sat, 17 Feb 2018 07:23:32 +1100, Tim Cross > wrote: >> Thomas Kellerer writes: >>> Plus: trimming the original content, so that not the whole email >>> thread is repeated in the quote. >> While I'm happy to comply, I disagree with trimming/editing the >> thread. > Th

Re: shared_buffers 8GB maximum

2018-02-16 Thread Jeff Janes
On Fri, Feb 16, 2018 at 2:36 PM, Vitaliy Garnashevich < vgarnashev...@gmail.com> wrote: > Hi All, > > I've seen the shared_buffers 8GB maximum recommendation repeated many > times. I have several questions in this regard. > > - Is this recommendation still true for recent versions of postgres? (e.

List policy/procedures [was Database health check/auditing]

2018-02-16 Thread Tim Cross
George Neuner writes: > On Sat, 17 Feb 2018 07:23:32 +1100, Tim Cross > wrote: > >>Thomas Kellerer writes: >> >>> Plus: trimming the original content, so that not the whole email >>> thread is repeated in the quote. >> >>While I'm happy to comply, I disagree with trimming/editing the >>thread.

Re: shared_buffers 8GB maximum

2018-02-16 Thread Tomas Vondra
On 02/17/2018 02:56 AM, George Neuner wrote: > On Sat, 17 Feb 2018 00:36:57 +0200, Vitaliy Garnashevich > wrote: > ... > >> Could that be a reason for increasing the value of shared_buffers? >> >> - Could shared_buffers=128GB or more on a 250 GB RAM server be a >> reasonable setting? What downs

Re: Database health check/auditing

2018-02-16 Thread George Neuner
On Sat, 17 Feb 2018 07:23:32 +1100, Tim Cross wrote: >Thomas Kellerer writes: > >> Plus: trimming the original content, so that not the whole email >> thread is repeated in the quote. > >While I'm happy to comply, I disagree with trimming/editing the >thread. Certainly made sense when networks w

Re: Any hope for more specific error message for "value too long..."?

2018-02-16 Thread geoff hoffman
Dang. +1 for that. Not that you hadn’t thought of it, and not that it’s actually a viable solution in a jiffy, but switch that mess to JSONB and your problems are over.

Re: shared_buffers 8GB maximum

2018-02-16 Thread George Neuner
On Sat, 17 Feb 2018 00:36:57 +0200, Vitaliy Garnashevich wrote: >- I'm not a huge Linux expert, but I've heard someone saying that >reading from the filesystem cache requires a context switch. Yes. >I suspect >that such reads are slightly more expensive now after the >Meltdown/Spectre patch

Re: Any hope for more specific error message for "value too long..."?

2018-02-16 Thread Tom Lane
"David G. Johnston" writes: > I seem to recall a discussion a few years back but cannot find it searching > online. The one post I did find was from 6 years ago and I was the only > respondent and basically said the same or less than I am here. I dug in the archives and came across a crude POC h

Re: Any hope for more specific error message for "value too long..."?

2018-02-16 Thread David G. Johnston
On Fri, Feb 16, 2018 at 5:30 PM, Ken Tanzer wrote: > > That doesn't matter much in a simple example like that, but the example > below is currently making me wish PG was just a little bit more specific. > Is there much chance of this changing in future releases? > > ​ I'm not holding my breath...

Re: Any hope for more specific error message for "value too long..."?

2018-02-16 Thread Tom Lane
Ken Tanzer writes: > Hi. If you try to assign a too-long string to a field, Postgresql will say > so, but won't tell you which value/field is causing the problem: > CREATE TEMP TABLE foo (a VARCHAR(2)); > INSERT INTO foo VALUES ('ABC'); > CREATE TABLE > ERROR: value too long for type character v

Re: Rationale for PUBLIC having CREATE and USAGE privileges on the schema "public" by default

2018-02-16 Thread David G. Johnston
On Fri, Feb 16, 2018 at 4:50 PM, Olegs Jeremejevs wrote: > Hi, > > I'm aware that these default privileges are documented: > > https://www.postgresql.org/docs/10/static/ddl-schemas. > html#DDL-SCHEMAS-PRIV > > However, I'm unable to find any reasoning behind their existence. > Normally, one can j

Re: Trigger (or something similar) on table rename?

2018-02-16 Thread Tom Lane
Ken Tanzer writes: > Presumably the complete command would let you figure out it's a rename, and > the old and new tables. But I found this message ( > https://postgrespro.com/list/thread-id/1561932) stating that a > pg_ddl_command could only be processed in C, not in a procedural language. > I'm

Any hope for more specific error message for "value too long..."?

2018-02-16 Thread Ken Tanzer
Hi. If you try to assign a too-long string to a field, Postgresql will say so, but won't tell you which value/field is causing the problem: CREATE TEMP TABLE foo (a VARCHAR(2)); INSERT INTO foo VALUES ('ABC'); CREATE TABLE ERROR: value too long for type character varying(2) That doesn't matter

Re: Trigger (or something similar) on table rename?

2018-02-16 Thread Ken Tanzer
On Thu, Feb 15, 2018 at 11:01 AM, Tom Lane wrote: > Ken Tanzer writes: > > Something like a trigger on the table rename would be ideal for my > > purposes. Anything like that possible? Thanks! > > Recent PG versions have "event triggers" which would serve the purpose. > However, the infrastruc

Rationale for PUBLIC having CREATE and USAGE privileges on the schema "public" by default

2018-02-16 Thread Olegs Jeremejevs
Hi, I'm aware that these default privileges are documented: https://www.postgresql.org/docs/10/static/ddl-schemas.html#DDL-SCHEMAS-PRIV However, I'm unable to find any reasoning behind their existence. Normally, one can just revoke them and move on, but they have caused me some trouble in a mana

Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Thiemo Kellner
On 02/16/18 14:47, Thiemo Kellner, NHC Barhufpflege wrote: Thanks for answering. Zitat von Pavel Stehule : Why you don't create query like EXECUTE 'SELECT xxx FROM TAB WHERE A = $1.x AND B = $1.y'  USING NEW; I shall try. This would be the direct way, but I doubt the placeholder $1 can be

Re: gathering ownership and grant permissions

2018-02-16 Thread Melvin Davidson
On Fri, Feb 16, 2018 at 3:50 PM, chris wrote: > I'm sorry I realized that I only need to know which users have permissions > to the table which I can do through > > $ psql -t > > SELECT grantee > FROM information_schema.role_table_grants > WHERE table_name='table_name' > GROUP BY grantee; > > tha

shared_buffers 8GB maximum

2018-02-16 Thread Vitaliy Garnashevich
Hi All, I've seen the shared_buffers 8GB maximum recommendation repeated many times. I have several questions in this regard. - Is this recommendation still true for recent versions of postgres? (e.g. wasn't it the case only for really old versions where the locks on shared buffers worked mu

Re: gathering ownership and grant permissions

2018-02-16 Thread chris
I'm sorry I realized that I only need to know which users have permissions to the table which I can do through $ psql -t SELECT grantee FROM information_schema.role_table_grants WHERE table_name='table_name' GROUP BY grantee; thanks! On 02/16/2018 01:13 PM, chris wrote: Thanks for the qui

Re: Database health check/auditing

2018-02-16 Thread Basques, Bob (CI-StPaul)
What Tim said!! :c) I think the bigger deal is setting a new message Subject at the approriate point in a thread/conversation. bobb On Feb 16, 2018, at 2:23 PM, Tim Cross mailto:theophil...@gmail.com>> wrote: Thomas Kellerer mailto:spam_ea...@gmx.net>> writes: Melvin Davidson schrieb am

Re: Database health check/auditing

2018-02-16 Thread Tim Cross
Thomas Kellerer writes: > Melvin Davidson schrieb am 16.02.2018 um 05:26: >> Tim, >> >> FYI, the policy in this list is to avoid top posting and bottom post instead. > > Plus: trimming the original content, so that not the whole email thread is > repeated in the quote. > > Thomas While I'm ha

Re: Database health check/auditing

2018-02-16 Thread Tim Cross
Melvin Davidson writes: > On Fri, Feb 16, 2018 at 10:46 AM, Basques, Bob (CI-StPaul) < > bob.basq...@ci.stpaul.mn.us> wrote: > >> >> What about bottom *and* top posting. Just joking sort of. I really like >> to reply to questions inline myself on a lot of occasions. >> >> Seems like a good Mai

Re: gathering ownership and grant permissions

2018-02-16 Thread chris
Thanks for the quick response. That does not work for what I need because I only need the owner and permissions of one table, I need the grant to look like the output that pg_dump displays. ex: GRANT ALL ON TABLE testing_cdc TO bob; -- -- PostgreSQL database dump complete -- I need a way

Re: gathering ownership and grant permissions

2018-02-16 Thread Melvin Davidson
On Fri, Feb 16, 2018 at 2:47 PM, chris wrote: > HI, > > I would like to know if there is a better way to grab the grant > permissions as well as the "owner to" of a table. > > I can currently do this through a pg_dumb with greps for "^grant" and > "^alter" but than I need to do a word search of

Re: Database health check/auditing

2018-02-16 Thread Tim Cross
Thomas Kellerer writes: >> situation: I have just commenced a DBA and developer role for an >> organisation with a number of Postgres databases (9.4 and 9.6 >> versions). There has been no dedicated DBA and a number of the databases >> were setup by people with little to know Postgres or databas

Re: Database health check/auditing

2018-02-16 Thread Tim Cross
Ibrahim Edib Kokdemir writes: > Hi Tim, > There are good continuously running apps to monitor postgres. > IMHO, the most successful one is pgcenter. > Here is the link. https://github.com/lesovsky/pgcenter > Thanks, a useful link. Tim -- Tim Cross

Re: Database health check/auditing

2018-02-16 Thread Melvin Davidson
On Fri, Feb 16, 2018 at 2:40 PM, Basques, Bob (CI-StPaul) < bob.basq...@ci.stpaul.mn.us> wrote: > All, > > Not really an app, but we have a Apache script that logs all the activity > to our Postgres/PostGIS services and inserts the log entries directly into > Postgres. Works great for reporting o

gathering ownership and grant permissions

2018-02-16 Thread chris
HI, I would like to know if there is a better way to grab the grant permissions  as well as the "owner to" of a table. I can currently do this through a pg_dumb with greps for "^grant" and "^alter" but than I need to do a word search of those lines looking for the specific answers which gets

Re: Database health check/auditing

2018-02-16 Thread Basques, Bob (CI-StPaul)
All, Not really an app, but we have a Apache script that logs all the activity to our Postgres/PostGIS services and inserts the log entries directly into Postgres. Works great for reporting our Postgres web traffic stuff. My dev guy was skeptical about it being effective and not binding up at

Re: postgres started without auto vaccum

2018-02-16 Thread Laurenz Albe
Azimuddin Mohammed wrote: > I am getting below Warning messages in logs after starting postgres, can some > please help me here > > LOG: could not bind socket for statistics collector: Cannot assign requested > address > LOG: disabling statistics collector for lack of working socket > WARNING:

Re: postgres started without auto vaccum

2018-02-16 Thread Adrian Klaver
On 02/16/2018 09:21 AM, Azimuddin Mohammed wrote: Yes, I did. The first start happened without any issues. But the next restart i see the errors. Was the first start before you removed the data/ directory or after you restored it? If the first start was after the restore did anything else

Re: postgres started without auto vaccum

2018-02-16 Thread Melvin Davidson
On Fri, Feb 16, 2018 at 12:21 PM, Azimuddin Mohammed wrote: > Yes, I did. The first start happened without any issues. But the next > restart i see the errors. > > On Feb 16, 2018 7:54 AM, "Adrian Klaver" > wrote: > >> On 02/15/2018 09:54 PM, Azimuddin Mohammed wrote: >> >>> Hello All, >>> I am

Re: postgres started without auto vaccum

2018-02-16 Thread Azimuddin Mohammed
Yes, I did. The first start happened without any issues. But the next restart i see the errors. On Feb 16, 2018 7:54 AM, "Adrian Klaver" wrote: > On 02/15/2018 09:54 PM, Azimuddin Mohammed wrote: > >> Hello All, >> I am getting below Warning messages in logs after starting postgres, can >> some

Re: Database health check/auditing

2018-02-16 Thread Thomas Kellerer
situation: I have just commenced a DBA and developer role for an organisation with a number of Postgres databases (9.4 and 9.6 versions). There has been no dedicated DBA and a number of the databases were setup by people with little to know Postgres or database experience. I need to get an overvie

Re: Database health check/auditing

2018-02-16 Thread Ibrahim Edib Kokdemir
Hi Tim, There are good continuously running apps to monitor postgres. IMHO, the most successful one is pgcenter. Here is the link. https://github.com/lesovsky/pgcenter Regards İbrahim On 16 Feb 2018 5:22 am, "Tim Cross" wrote: > Hi All, > > I was wondering if anyone has some pointers to > site

Re: Remove default privilege from DB

2018-02-16 Thread David G. Johnston
On Fri, Feb 16, 2018 at 8:59 AM, Stephen Frost wrote: > Tom, > > * Tom Lane (t...@sss.pgh.pa.us) wrote: > > Stephen Frost writes: > > > * David G. Johnston (david.g.johns...@gmail.com) wrote: > > >> ​Not sure if this is what you mean but there is no concept of > "negative > > >> state" in the pe

Re: Database health check/auditing

2018-02-16 Thread Melvin Davidson
On Fri, Feb 16, 2018 at 10:46 AM, Basques, Bob (CI-StPaul) < bob.basq...@ci.stpaul.mn.us> wrote: > Melvin, > > Thanks for posting these. I haven’t even looked at them yet and just > grabbed them based on the names. :c) > > > On Feb 15, 2018, at 9:11 PM, Melvin Davidson wrote: > > > > On Thu, Fe

Re: Remove default privilege from DB

2018-02-16 Thread Stephen Frost
Tom, * Tom Lane (t...@sss.pgh.pa.us) wrote: > Stephen Frost writes: > > * David G. Johnston (david.g.johns...@gmail.com) wrote: > >> ​Not sure if this is what you mean but there is no concept of "negative > >> state" in the permissions system. Everything starts out with no > >> permissions. Gra

Re: Remove default privilege from DB

2018-02-16 Thread Tom Lane
Stephen Frost writes: > * David G. Johnston (david.g.johns...@gmail.com) wrote: >> ​Not sure if this is what you mean but there is no concept of "negative >> state" in the permissions system. Everything starts out with no >> permissions. Grant adds permissions and revoke un-adds granted >> permi

Re: Database health check/auditing

2018-02-16 Thread Basques, Bob (CI-StPaul)
Melvin, Thanks for posting these. I haven’t even looked at them yet and just grabbed them based on the names. :c) On Feb 15, 2018, at 9:11 PM, Melvin Davidson mailto:melvin6...@gmail.com>> wrote: On Thu, Feb 15, 2018 at 9:22 PM, Tim Cross mailto:theophil...@gmail.com>> wrote: Hi All, I

Re: Remove default privilege from DB

2018-02-16 Thread Stephen Frost
Greetings, * David G. Johnston (david.g.johns...@gmail.com) wrote: > On Fri, Feb 16, 2018 at 7:56 AM, Durumdara wrote: > > > I want to know what happened in the background. > > I will make "negative" state if I revoke DefACL without prior grant? > > ​Not really following the whole thread but fi

Re: Remove default privilege from DB

2018-02-16 Thread David G. Johnston
On Fri, Feb 16, 2018 at 7:56 AM, Durumdara wrote: > I want to know what happened in the background. > I will make "negative" state if I revoke DefACL without prior grant? > ​Not really following the whole thread but figured I'm comment on this point that confused me in the past as well.​ ​Not s

Re: Remove default privilege from DB

2018-02-16 Thread Durumdara
Dear Charles! I did search on backup SQL, and I found 4 lines. All of them needed. I reversed them (Revoke to Grant): ALTER DEFAULT PRIVILEGES FOR ROLE suser grant ALL ON TYPES to PUBLIC; ALTER DEFAULT PRIVILEGES FOR ROLE suser grant ALL ON TYPES to suser; ALTER DEFAULT PRIVILEGES FOR ROLE sus

Re: strange construct with RETURN within plpgsql

2018-02-16 Thread Pavel Stehule
2018-02-16 14:20 GMT+01:00 mariusz : > On Fri, 2018-02-16 at 13:51 +0100, Pavel Stehule wrote: > > > > It is not a bug, it is feature. Sometimes not nice. RETURN is keyword > > in procedural part, but it is nothing in sql part. > > > thanks, i haven't thought about such an obvious thing, i feel re

Re: Remove default privilege from DB

2018-02-16 Thread Durumdara
Dear Charles - Prof. Xavier? :-) I made a restore to my local Windows PG. Here I also see these anomalies. 4594262;0;"S";"{}" 4594262;0;"T";"{}" 4594262;0;"f";"{}" 4594262;0;"r";"{}" In restore SQL I saw: ALTER DEFAULT PRIVILEGES FOR ROLE suser REVOKE ALL ON TABLES FROM suser; Because of that

RE: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Igor Neyman
Hi all I would like to have a generic trigger function that compares on insert if there is already a record in the table with the very same values. Using PL/pgSQL ( I am not bound to that) I know the insert record structure from the new record and I can build a select query dynamically from the

Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Thiemo Kellner
Zitat von Daniel Verite : Thiemo Kellner, NHC Barhufpflege wrote: > Why you don't create query like > > EXECUTE 'SELECT xxx FROM TAB WHERE A = $1.x AND B = $1.y' USING NEW; I shall try. This would be the direct way, but I doubt the placeholder $1 can be a record. It could be writte

Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Daniel Verite
Thiemo Kellner, NHC Barhufpflege wrote: > > Why you don't create query like > > > > EXECUTE 'SELECT xxx FROM TAB WHERE A = $1.x AND B = $1.y' USING NEW; > > I shall try. This would be the direct way, but I doubt the placeholder > $1 can be a record. It could be written without referin

Re: postgres started without auto vaccum

2018-02-16 Thread Adrian Klaver
On 02/15/2018 09:54 PM, Azimuddin Mohammed wrote: Hello All, I am getting below Warning messages in logs after starting postgres, can some please help me here LOG: could not bind socket for statistics collector: Cannot assign requested address LOG: disabling statistics collector for lack of

Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Thiemo Kellner, NHC Barhufpflege
Thanks for answering. Zitat von Pavel Stehule : Why you don't create query like EXECUTE 'SELECT xxx FROM TAB WHERE A = $1.x AND B = $1.y' USING NEW; I shall try. This would be the direct way, but I doubt the placeholder $1 can be a record. I don't understand tou your case, but usually

Re: strange construct with RETURN within plpgsql

2018-02-16 Thread mariusz
On Fri, 2018-02-16 at 13:51 +0100, Pavel Stehule wrote: > It is not a bug, it is feature. Sometimes not nice. RETURN is keyword > in procedural part, but it is nothing in sql part. > thanks, i haven't thought about such an obvious thing, i feel really ashamed. of course it makes sense now. i gue

Re: strange construct with RETURN within plpgsql

2018-02-16 Thread David G. Johnston
On Fri, Feb 16, 2018 at 6:08 AM, mariusz wrote: > On Fri, 2018-02-16 at 05:40 -0700, David G. Johnston wrote: > > On Fri, Feb 16, 2018 at 5:31 AM, mariusz wrote: > > > > so, if there is a reason for such a construct and it does > > something i > > didn't notice, please le

Re: strange construct with RETURN within plpgsql

2018-02-16 Thread mariusz
On Fri, 2018-02-16 at 05:40 -0700, David G. Johnston wrote: > On Fri, Feb 16, 2018 at 5:31 AM, mariusz wrote: > > so, if there is a reason for such a construct and it does > something i > didn't notice, please let me know what is the purpose of > keyword RETURN >

Re: Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Pavel Stehule
Hi 2018-02-16 13:20 GMT+01:00 Thiemo Kellner : > Hi all > > I would like to have a generic trigger function that compares on insert if > there is already a record in the table with the very same values. Using > PL/pgSQL ( I am not bound to that) I know the insert record structure from > the new r

Re: strange construct with RETURN within plpgsql

2018-02-16 Thread Pavel Stehule
2018-02-16 13:31 GMT+01:00 mariusz : > > hello all, > > i just noticed some strange thing in plpgsql, that is keyword RETURN is > allowed as noop after a valid statement. > shame on me, after so many years of using plpgsql i happened to write a > bug omitting semicolon after statement just before

Re: Remove default privilege from DB

2018-02-16 Thread Durumdara
Hello! 2018-02-15 14:19 GMT+01:00 Charles Clavadetscher : > What version of PostgreSQL are you using? > > And how did you get those first entries at all? > > What happens if you issue > > ALTER DEFAULT PRIVILEGES FOR ROLE suser GRANT EXECUTE ON FUNCTIONS TO > PUBLIC; > > again? > > > After that:

Re: strange construct with RETURN within plpgsql

2018-02-16 Thread David G. Johnston
On Fri, Feb 16, 2018 at 5:31 AM, mariusz wrote: > so, if there is a reason for such a construct and it does something i > didn't notice, please let me know what is the purpose of keyword RETURN > after a valid statement. > ​ https://www.postgresql.org/docs/10/static/plpgsql-control-structures.ht

strange construct with RETURN within plpgsql

2018-02-16 Thread mariusz
hello all, i just noticed some strange thing in plpgsql, that is keyword RETURN is allowed as noop after a valid statement. shame on me, after so many years of using plpgsql i happened to write a bug omitting semicolon after statement just before RETURN, and so i found that "special"? construct.

Dynamic PL/pgSQL select query: value association propblem

2018-02-16 Thread Thiemo Kellner
Hi all I would like to have a generic trigger function that compares on insert if there is already a record in the table with the very same values. Using PL/pgSQL ( I am not bound to that) I know the insert record structure from the new record and I can build a select query dynamically fr

Re: Parallel Query - Can it be used within functions?

2018-02-16 Thread Michael Krüger
Dear all, still same behavior with Postgres 10.2 ... Just as a reminder that the issue still exists. Regards, Michael Andreas Kretschmer schrieb am Di., 6. Feb. 2018 um 08:35 Uhr: > Hi, > > > Am 06.02.2018 um 08:24 schrieb Michael Krüger: > > create or replace function reports.generic_query(_