Re: feature request ctid cast / sql exception

2021-04-18 Thread Vladimír Houba ml .
This is a specific use case, I have a big table without a pk. Updates with ctid are blazing fast even without an index. I dont need it. The argument behind this is that users excpect this functionality, its not just me. Search stackoverflow. They end up using various suboptimal solutions as I desc

回复: Core dump happens when execute sql CREATE VIEW v1(c1) AS (SELECT ('4' COLLATE "C")::INT FROM generate_series(1, 10));

2021-04-18 Thread Yulin PEI
After several tests, I found that this patch do not fix the bug well. I think we should use the same logic to treat parent CollateExpr and child CollateExpr. In your patch, if the parent node is CollateExpr and the target type is non-collatable, we coerce CollateExpr->arg. If the child

Re: feature request ctid cast / sql exception

2021-04-18 Thread Vladimír Houba ml .
I use ctid as a row identifier within a transaction in a Java application. To obtain the row ctid I either have to - cast it to text and store it as String - cast it to string, then convert it to a bigint using UDF which is inefficient I wish I could just cast ctid to bigint and store it

Re: [CLOBBER_CACHE]Server crashed with segfault 11 while executing clusterdb

2021-04-18 Thread Michael Paquier
On Fri, Apr 09, 2021 at 06:45:45PM -0400, Alvaro Herrera wrote: > We forgot this patch earlier in the commitfest. Do people think we > should still get it in on this cycle? I'm +1 on that, since it's a > safety feature poised to prevent more bugs than it's likely to > introduce. No objections fr

Re: Remove redundant variable from transformCreateStmt

2021-04-18 Thread Amul Sul
On Mon, Apr 19, 2021 at 11:05 AM Bharath Rupireddy wrote: > > On Mon, Apr 19, 2021 at 9:32 AM Amul Sul wrote: > > Kindly ignore the previous version -- has unnecessary change. > > See the attached. > > Thanks for the patch! > > How about a slight rewording of the added comment to "Constraints > v

Re: Table refer leak in logical replication

2021-04-18 Thread Michael Paquier
On Mon, Apr 19, 2021 at 03:08:41PM +0900, Michael Paquier wrote: > FWIW, I > would be tempted to send back f1ac27b to the blackboard, then refactor > the code of the apply worker to use ExecInitResultRelation() so as we > get more consistency with resource releases, simplifying the business > with

Re: Table refer leak in logical replication

2021-04-18 Thread Michael Paquier
On Sat, Apr 17, 2021 at 07:02:00PM +0530, Amit Kapila wrote: > Hmm, I am not sure if it is a good idea to open indexes needlessly > especially when it is not done in the previous code. Studying the history of this code, I think that f1ac27b is to blame here for making the code of the apply worker

Windows default locale vs initdb

2021-04-18 Thread Thomas Munro
Hi, Moving this topic into its own thread from the one about collation versions, because it concerns pre-existing problems, and that thread is long. Currently initdb sets up template databases with old-style Windows locale names reported by the OS, and they seem to have caused us quite a few prob

Re: Remove redundant variable from transformCreateStmt

2021-04-18 Thread Bharath Rupireddy
On Mon, Apr 19, 2021 at 9:32 AM Amul Sul wrote: > Kindly ignore the previous version -- has unnecessary change. > See the attached. Thanks for the patch! How about a slight rewording of the added comment to "Constraints validation can be skipped for a newly created table as it contains no data.

Re: PG Docs - CREATE SUBSCRIPTION option list order

2021-04-18 Thread Amit Kapila
On Mon, Apr 19, 2021 at 10:32 AM Peter Smith wrote: > > On Mon, Apr 19, 2021 at 2:09 PM Amit Kapila wrote: > > > > On Mon, Apr 19, 2021 at 6:32 AM Euler Taveira wrote: > > > > > > On Sun, Apr 18, 2021, at 8:59 PM, Peter Smith wrote: > > > > > > The CREATE SUBSCRIPTION documentation [1] includes

Re: Replication slot stats misgivings

2021-04-18 Thread Amit Kapila
On Mon, Apr 19, 2021 at 9:00 AM Masahiko Sawada wrote: > > On Fri, Apr 16, 2021 at 2:58 PM Amit Kapila wrote: > > > > > > 4. > > +CREATE VIEW pg_stat_replication_slots AS > > +SELECT > > +s.slot_name, > > +s.spill_txns, > > +s.spill_count, > > +

Re: PG Docs - CREATE SUBSCRIPTION option list order

2021-04-18 Thread Peter Smith
On Mon, Apr 19, 2021 at 2:09 PM Amit Kapila wrote: > > On Mon, Apr 19, 2021 at 6:32 AM Euler Taveira wrote: > > > > On Sun, Apr 18, 2021, at 8:59 PM, Peter Smith wrote: > > > > The CREATE SUBSCRIPTION documentation [1] includes a list of "WITH" > > options, which are currently in some kind of qua

Re: New Table Access Methods for Multi and Single Inserts

2021-04-18 Thread Bharath Rupireddy
On Mon, Apr 5, 2021 at 9:49 AM Bharath Rupireddy wrote: > > On Wed, Mar 10, 2021 at 10:21 AM Bharath Rupireddy > wrote: > > Attaching the v4 patch set. Please review it further. > > Attaching v5 patch set after rebasing onto the latest master. Another rebase due to conflicts in 0003. Attaching v

Re: Performance degradation of REFRESH MATERIALIZED VIEW

2021-04-18 Thread Masahiko Sawada
On Fri, Apr 16, 2021 at 12:16 PM Kyotaro Horiguchi wrote: > > At Mon, 12 Apr 2021 15:20:41 +0900, Masahiko Sawada > wrote in > > . > > > > On Thu, Mar 11, 2021 at 5:44 PM Masahiko Sawada > > wrote: > > > > > > Hi, > > > > > > While discussing freezing tuples during CTAS[1], we found that > > >

Re: Replication slot stats misgivings

2021-04-18 Thread Amit Kapila
On Fri, Apr 16, 2021 at 8:50 AM Justin Pryzby wrote: > > On Fri, Apr 16, 2021 at 08:48:29AM +0530, Amit Kapila wrote: > > I am fine with your proposed changes. There are one or two more > > patches in this area. I can include your suggestions along with those > > if you don't mind? > > However's c

Re: Replication slot stats misgivings

2021-04-18 Thread Amit Kapila
On Sun, Apr 18, 2021 at 6:51 PM Masahiko Sawada wrote: > > Yes, also the following expectation in expected/stats.out is wrong: > > SELECT slot_name, spill_txns = 0 AS spill_txns, spill_count = 0 AS > spill_count, total_txns > 0 AS total_txns, total_bytes > 0 AS > total_bytes FROM pg_stat_replicati

Re: PG Docs - CREATE SUBSCRIPTION option list order

2021-04-18 Thread Amit Kapila
On Mon, Apr 19, 2021 at 6:32 AM Euler Taveira wrote: > > On Sun, Apr 18, 2021, at 8:59 PM, Peter Smith wrote: > > The CREATE SUBSCRIPTION documentation [1] includes a list of "WITH" > options, which are currently in some kind of quasi alphabetical / > random order which I found unnecessarily confu

Re: Remove redundant variable from transformCreateStmt

2021-04-18 Thread Amul Sul
On Mon, Apr 19, 2021 at 9:28 AM Amul Sul wrote: > > On Fri, Apr 16, 2021 at 6:26 AM Bharath Rupireddy > wrote: > > > > On Thu, Apr 15, 2021 at 8:40 PM Jeevan Ladhe > > wrote: > > > IMHO, I think the idea here was to just get rid of an unnecessary variable > > > rather than refactoring. > > > > >

Re: Remove redundant variable from transformCreateStmt

2021-04-18 Thread Amul Sul
On Fri, Apr 16, 2021 at 6:26 AM Bharath Rupireddy wrote: > > On Thu, Apr 15, 2021 at 8:40 PM Jeevan Ladhe > wrote: > > IMHO, I think the idea here was to just get rid of an unnecessary variable > > rather than refactoring. > > > > On Thu, Apr 15, 2021 at 5:48 PM Bharath Rupireddy > > wrote: > >

Re: Replication slot stats misgivings

2021-04-18 Thread Masahiko Sawada
On Fri, Apr 16, 2021 at 2:58 PM Amit Kapila wrote: > > On Thu, Apr 15, 2021 at 4:35 PM Masahiko Sawada wrote: > > > > Thank you for the update! The patch looks good to me. > > > > I have pushed the first patch. Comments on the next patch > v13-0001-Use-HTAB-for-replication-slot-statistics: > 1. >

Re: doc review for v14

2021-04-18 Thread Michael Paquier
On Fri, Apr 16, 2021 at 02:03:10AM -0500, Justin Pryzby wrote: > A bunch more found with things like this. Thanks, applied most of it! -- Michael signature.asc Description: PGP signature

Re: File truncation within PostgresNode::issues_sql_like() wrong on Windows

2021-04-18 Thread Michael Paquier
On Sat, Apr 17, 2021 at 09:55:47AM -0400, Andrew Dunstan wrote: > Yes please, much better to use a symbolic name rather than a magic > number. I wouldn't bother backpatching it though. Okay, done this way then. -- Michael signature.asc Description: PGP signature

Re: PG Docs - CREATE SUBSCRIPTION option list order

2021-04-18 Thread Euler Taveira
On Sun, Apr 18, 2021, at 8:59 PM, Peter Smith wrote: > The CREATE SUBSCRIPTION documentation [1] includes a list of "WITH" > options, which are currently in some kind of quasi alphabetical / > random order which I found unnecessarily confusing. > > I can't think of any good reason for the current

PG Docs - CREATE SUBSCRIPTION option list order

2021-04-18 Thread Peter Smith
Hi, The CREATE SUBSCRIPTION documentation [1] includes a list of "WITH" options, which are currently in some kind of quasi alphabetical / random order which I found unnecessarily confusing. I can't think of any good reason for the current ordering, so PSA my patch which has identical content but

Re: track_planning causing performance regression

2021-04-18 Thread Justin Pryzby
Reviewing this change which was committed last year as 321fa6a4a26c9b649a0fbec9fc8b019f19e62289 On Fri, Jul 03, 2020 at 03:57:38PM +0900, Fujii Masao wrote: > On 2020/07/03 13:05, Pavel Stehule wrote: > > pá 3. 7. 2020 v 4:39 odesílatel Fujii Masao > > napsal: > > > > Maybe there can be documen

Re: pg_amcheck option to install extension

2021-04-18 Thread Alvaro Herrera
On 2021-Apr-18, Andrew Dunstan wrote: > On 4/17/21 3:43 PM, Mark Dilger wrote: > > I'd also like your impressions on whether we're likely to move > > contrib/amcheck into core anytime soon. If so, is it worth adding > > an option that we'll soon need to deprecate? > > I think if it stays as an

Re: partial heap only tuples

2021-04-18 Thread Peter Geoghegan
On Tue, Feb 9, 2021 at 10:48 AM Bossart, Nathan wrote: > I'm hoping to gather some early feedback on a heap optimization I've > been working on. In short, I'm hoping to add "partial heap only > tuple" (PHOT) support, which would allow you to skip updating indexes > for unchanged columns even when

Re: pg_amcheck option to install extension

2021-04-18 Thread Mark Dilger
> On Apr 18, 2021, at 6:19 AM, Andrew Dunstan wrote: > > how about specifying pg_catalog as the schema instead of public? Done. v2-0001-Adding-install-missing-option-to-pg_amcheck.patch Description: Binary data — Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreS

Re: SQL-standard function body

2021-04-18 Thread Tom Lane
... BTW, a dependency loop is also possible without using this feature, by abusing default-value expressions: create function f1(x int, y int) returns int language sql as 'select $1 + $2'; create function f2(x int, y int default f1(1,2)) returns int language sql as 'select $1 + $2'; create or repl

Re: SQL-standard function body

2021-04-18 Thread Justin Pryzby
On Sun, Apr 18, 2021 at 03:08:44PM -0400, Tom Lane wrote: > Noah Misch writes: > > Should we be okay releasing v14 without support for breaking function > > dependency loops, or does that call for an open item? > > Oh! That should definitely be an open item. It doesn't seem > that hard to do so

Re: Planning time grows exponentially with levels of nested views

2021-04-18 Thread Joel Jacobson
On Sun, Apr 18, 2021, at 22:14, Tom Lane wrote: > "Joel Jacobson" mailto:joel%40compiler.org>> writes: > > I assumed the cost for each nested VIEW layer would grow linear, > > but my testing shows it appears to grow exponentially: > > I think it's impossible to avoid less-than-O(N^2) growth on thi

Re: Planning time grows exponentially with levels of nested views

2021-04-18 Thread Tom Lane
I wrote: > If multiple references are actually possible then this'd break it. There > seem to be no such cases in the regression tests though, and I'm having a > hard time wrapping my brain around what would cause it. "git blame" > traces this text to my own commit f44639e1b, which has the log en

Re: Old Postgresql version on i7-1165g7

2021-04-18 Thread Yura Sokolov
Tom Lane писал 2021-04-13 17:45: Justin Pryzby writes: On Fri, Apr 09, 2021 at 04:28:25PM +0300, Yura Sokolov wrote: Occasinally I found I'm not able to `make check` old Postgresql versions. I've bisected between REL_11_0 and "Rename pg_rewind's copy_file_range()" and found 372728b0d495526

Re: Planning time grows exponentially with levels of nested views

2021-04-18 Thread Tom Lane
[ redirecting to -hackers so the cfbot can see it ] "Joel Jacobson" writes: > I assumed the cost for each nested VIEW layer would grow linear, > but my testing shows it appears to grow exponentially: I think it's impossible to avoid less-than-O(N^2) growth on this sort of case. For example, the

Re: More info on pg_stat_activity Wait Event Name when is DataFileRead

2021-04-18 Thread Robert Haas
On Sat, Apr 17, 2021 at 1:58 PM PegoraroF10 wrote: > This long explaining was only to show, at least for me, that would be > desirable to have an additional information when Postgres is waiting for a > file. What if DataFileRead showing relfilenode it´s waiting for ? I agree that this would be ni

Re: SQL-standard function body

2021-04-18 Thread Tom Lane
Noah Misch writes: > Should we be okay releasing v14 without support for breaking function > dependency loops, or does that call for an open item? Oh! That should definitely be an open item. It doesn't seem that hard to do something similar to what we do for views, i.e. create a dummy function

Re: SQL-standard function body

2021-04-18 Thread Noah Misch
On Tue, Jun 30, 2020 at 02:51:38PM -0400, Tom Lane wrote: > The point remains that exposing the function body's dependencies will > constrain restore order far more than we are accustomed to see. It > might be possible to build examples that flat out can't be restored, > even granting that we teac

Re: 回复: Core dump happens when execute sql CREATE VIEW v1(c1) AS (SELECT ('4' COLLATE "C")::INT FROM generate_series(1, 10));

2021-04-18 Thread Tom Lane
Yulin PEI writes: > After several tests, I found that this patch do not fix the bug well. What do you think is wrong with it? > So the attachment is my patch and it works well as far as I tested. This seems equivalent to the already-committed patch [1] except that it wastes a makeNode call

Re: "could not find pathkey item to sort" for TPC-DS queries 94-96

2021-04-18 Thread Tom Lane
I wrote: > I think it's time for some refactoring of this code so that we can > actually share the logic. Accordingly, I propose the attached. After sleeping on it, here's an improved version that gets rid of an unnecessary assumption about ECs usually not containing both parallel-safe and parall

Re: 2 questions about volatile attribute of pg_proc.

2021-04-18 Thread David G. Johnston
On Sun, Apr 18, 2021 at 9:08 AM Tom Lane wrote: > Isaac Morland writes: > > On Sun, 18 Apr 2021 at 11:36, Tom Lane wrote: > >> Are you familiar with the halting problem? I don't see any meaningful > >> difference here. > > > I think what is being suggested is akin to type checking, not solving

Re: 2 questions about volatile attribute of pg_proc.

2021-04-18 Thread Tom Lane
Isaac Morland writes: > On Sun, 18 Apr 2021 at 11:36, Tom Lane wrote: >> Are you familiar with the halting problem? I don't see any meaningful >> difference here. > I think what is being suggested is akin to type checking, not solving the > halting problem. Yeah, on further thought we'd be sat

Re: 2 questions about volatile attribute of pg_proc.

2021-04-18 Thread Isaac Morland
On Sun, 18 Apr 2021 at 11:36, Tom Lane wrote: > Andy Fan writes: > > We know volatile is very harmful for optimizers and it is the default > > value (and safest value) if the user doesn't provide that. Asking user > > to set the value is not a good experience, is it possible to > auto-generate

Re: 2 questions about volatile attribute of pg_proc.

2021-04-18 Thread Tom Lane
Andy Fan writes: > We know volatile is very harmful for optimizers and it is the default > value (and safest value) if the user doesn't provide that. Asking user > to set the value is not a good experience, is it possible to auto-generate > the value for it rather than use the volatile directly

Re: Bogus collation version recording in recordMultipleDependencies

2021-04-18 Thread Tom Lane
Julien Rouhaud writes: > On Sat, Apr 17, 2021 at 10:01:53AM +1200, Thomas Munro wrote: >> It seems to me that there are two things that would be needed to >> salvage this for PG14: (1) deciding that we're unlikely to come up >> with a better idea than using pg_depend for this (following the >> arg

Re: 2 questions about volatile attribute of pg_proc.

2021-04-18 Thread Pavel Stehule
ne 18. 4. 2021 v 17:06 odesílatel Andy Fan napsal: > Hi: > > We know volatile is very harmful for optimizers and it is the default > value (and safest value) if the user doesn't provide that. Asking user > to set the value is not a good experience, is it possible to auto-generate > the value fo

2 questions about volatile attribute of pg_proc.

2021-04-18 Thread Andy Fan
Hi: We know volatile is very harmful for optimizers and it is the default value (and safest value) if the user doesn't provide that. Asking user to set the value is not a good experience, is it possible to auto-generate the value for it rather than use the volatile directly for user defined func

Consider parent's stats for set_append_rel_size.

2021-04-18 Thread Andy Fan
Hi: I would talk about the impact of init partition prune for set_append_rel_size. and create_append_path. Finally I just want to focus on set_append_rel_size only in this thread. Given the below example: CREATE TABLE P (part_key int, v int) PARTITION BY RANGE (part_key); CREATE TABLE p_1 PARTIT

Re: proposal - log_full_scan

2021-04-18 Thread Pavel Stehule
ne 18. 4. 2021 v 14:28 odesílatel Julien Rouhaud napsal: > On Sun, Apr 18, 2021 at 06:21:56AM +0200, Pavel Stehule wrote: > > > > The extension like pg_qualstat is good, but it does different work. > > Yes definitely. It was just an idea if you needed something right now that > could more or les

Re: Replication slot stats misgivings

2021-04-18 Thread vignesh C
On Sun, Apr 18, 2021 at 9:02 AM vignesh C wrote: > > On Sun, Apr 18, 2021 at 8:43 AM Amit Kapila wrote: > > > > On Sun, Apr 18, 2021 at 7:36 AM vignesh C wrote: > > > > > > On Sun, Apr 18, 2021 at 3:51 AM Tom Lane wrote: > > > > > > > > I wrote: > > > > > The buildfarm suggests that this isn't

Re: Replication slot stats misgivings

2021-04-18 Thread Masahiko Sawada
On Sun, Apr 18, 2021 at 12:13 PM Amit Kapila wrote: > > On Sun, Apr 18, 2021 at 7:36 AM vignesh C wrote: > > > > On Sun, Apr 18, 2021 at 3:51 AM Tom Lane wrote: > > > > > > I wrote: > > > > The buildfarm suggests that this isn't entirely stable: > > > > https://buildfarm.postgresql.org/cgi-bin/s

Re: pg_amcheck option to install extension

2021-04-18 Thread Andrew Dunstan
On 4/17/21 3:43 PM, Mark Dilger wrote: > >> On Apr 16, 2021, at 11:06 AM, Andrew Dunstan wrote: >> >> >> Hi, >> >> Peter Geoghegan suggested that I have the cross version upgrade checker >> run pg_amcheck on the upgraded module. This seemed to me like a good >> idea, so I tried it, only to find

Re: proposal - log_full_scan

2021-04-18 Thread Julien Rouhaud
On Sun, Apr 18, 2021 at 06:21:56AM +0200, Pavel Stehule wrote: > > The extension like pg_qualstat is good, but it does different work. Yes definitely. It was just an idea if you needed something right now that could more or less do what you needed, not saying that we shouldn't improve the core :

Fix dropped object handling in pg_event_trigger_ddl_commands

2021-04-18 Thread Sven Klemm
Hello, when creating an event trigger for ddl_command_end that calls pg_event_trigger_ddl_commands certain statements will cause the trigger to fail with a cache lookup error. The error happens on master, 13 and 12 I didnt test any previous versions. trg=# ALTER TABLE t ALTER COLUMN f1 SET DATA T

Re: Bogus collation version recording in recordMultipleDependencies

2021-04-18 Thread Julien Rouhaud
On Sat, Apr 17, 2021 at 10:01:53AM +1200, Thomas Munro wrote: > On Sat, Apr 17, 2021 at 8:39 AM Tom Lane wrote: > > Per the changes in collate.icu.utf8.out, this gets rid of > > a lot of imaginary collation dependencies, but it also gets > > rid of some arguably-real ones. In particular, calls of