REASSIGN OWNED BY in current database only

2021-01-14 Thread Andrus
Hi! Cluster contains lot databases. All objects in database should owned by separate role  whose name is in form databasename_owner where databasename is this database name in cluster. This role in granted to cluster users who should have acces to this database. Database is restored  from

RE: Strange (and good) side effect of partitioning ?

2021-01-14 Thread Phil Florent
Hi Tom, >The default value of constraint_exclusion is "partition", which means >(you guessed it) that it's applied only to potential partitioning >constraints. This is a heuristic based on the typical payoff of >excluding whole partitions versus skipping an empty index scan. >But if you have a wo

Re: Error messages on duplicate schema names

2021-01-14 Thread Michael Paquier
On Wed, Jan 06, 2021 at 07:15:24PM +0200, Andrus wrote: > Should duplicate schema names accepted or should their usage throw better > error messages. This means that we are one call of CommandCounterIncrement() short for such queries, and similar safeguards already exist in this area for GRANT/REV

RE: Strange (and good) side effect of partitioning ?

2021-01-14 Thread Phil Florent
Hi Tom, Hi Rob Thanks for this clear and complete explanation. My question was unclear since I didn't even consider the results could be identical and it was about the plans. I had misunderstood what J.Lewis had written since he probably meant some RDBMS always do a BETWEEN SYMETRIC. Our applic

Re: Strange (and good) side effect of partitioning ?

2021-01-14 Thread Tom Lane
I wrote: > There's no specific mechanism in Postgres that would cause "X between 20 > and 10" to be reduced to constant-false Wait, I take that back. There is a mechanism that can conclude that "X >= 20" and "X <= 10" are contradictory, but it's not applied by default. Observe: regression=# set

Re: Strange (and good) side effect of partitioning ?

2021-01-14 Thread Tom Lane
Phil Florent writes: > I read that on Jonathan Lewis' blog : > (I believe that there may be some RDBMS which will treat (e.g.) "X between 20 > and 10" as being identical to "X between 10 and 20" ) FWIW, I hope not, because the SQL spec is perfectly clear that it's not supposed to work like that.

Re: Like Query help

2021-01-14 Thread Bret Stern
Works. Thanks for the help. I will read the docs Best On 1/14/2021 4:37 PM, aNullValue (Drew Stemen) wrote: At 2021-01-14T19:27:23-05:00, Bret Stern sent: query select company_code, item_code, item_description, product_line, udf_item_width, udf_item_length, sales_unit_measure, ''as mat_type

Re: Strange (and good) side effect of partitioning ?

2021-01-14 Thread rob stone
Hi, On Thu, 2021-01-14 at 20:48 +, Phil Florent wrote: > Hi, > > I read that on Jonathan Lewis' blog : > > (I believe that there may be some RDBMS which will treat (e.g.) “X > between 20 and 10” as being identical to“X between 10 and 20” ) > > I am puzzled. PostgreSQL seems NOT to treat X b

Re: Like Query help

2021-01-14 Thread aNullValue (Drew Stemen)
At 2021-01-14T19:27:23-05:00, Bret Stern sent: > query > > select company_code, item_code, item_description, product_line, > udf_item_width, udf_item_length, sales_unit_measure, ''as mat_type from > mas_combined_item_master where company_code='BUR' or company_code='SNJ' > or company_code='EBC

Like Query help

2021-01-14 Thread Bret Stern
query select company_code, item_code, item_description, product_line, udf_item_width, udf_item_length, sales_unit_measure, ''as mat_type from mas_combined_item_master where company_code='BUR' or company_code='SNJ' or company_code='EBC' and udf_edb_managed='' and item_code LIKE 'S-%' order by

Strange (and good) side effect of partitioning ?

2021-01-14 Thread Phil Florent
Hi, I read that on Jonathan Lewis' blog : (I believe that there may be some RDBMS which will treat (e.g.) “X between 20 and 10” as being identical to “X between 10 and 20” ) I am puzzled. PostgreSQL seems NOT to treat X between 20 and 10” as being identical to “X between 10 and 20" but it's co

Re: postgres optimization

2021-01-14 Thread hubert depesz lubaczewski
On Thu, Jan 14, 2021 at 04:58:32PM +0530, Atul Kumar wrote: > I will be grateful if you can help me in understanding the basics and > slowly in depth optimization, by understanding explain plan. Consider reading https://www.depesz.com/tag/unexplainable/ depesz

postgres optimization

2021-01-14 Thread Atul Kumar
Hi, I am new to postgres and I find optimization as a challenge in postgres being a newbee. As I am unable to understand explain plan and its components like merge join, hash join, loop join etc. I get totally confused about how to read it and how to understand what thing is making my query slow

Re: Logical replication gradually slowing down, then hanging.

2021-01-14 Thread Lukasz Biegaj
On 16.11.2020 10:20, Lukasz Biegaj wrote: Hello, I'm encountering a repeating problem with logical replication. [...] And also a gdb backtrace: (gdb) bt #0  0x5623348d3ce0 in hash_seq_search () #1  0x56233473a396 in ReorderBufferQueueChange () #2  0x56233472fb80 in LogicalDecodingP

Re: Views and triggers more then one row returned by subquery.

2021-01-14 Thread Day, David
Tom, You are exactly right about STABLE needed on the get_rule_seq function. That resolved my issues. I've been burned before by using a function within a view/WHERE situation and the function was not marked STABLE. I need to start taking PREMAGEN. I Kind of came to the same conclusion in parra