Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-06 Thread Jeff Davis
V. does something different than CREATE, there would > certainly be value in being able to EXPLAIN what that does --- but > that still isn't an argument for allowing EXPLAIN CREATE MATERIALIZED > VIEW. We already allow EXPLAIN ANALYZE CREATE MATERIALIZED VIEW in all supported versions.

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-06 Thread Yugo NAGATA
save_sec_context = 0; + int save_nestlevel = 0; + if (es->memory) { /* @@ -487,6 +493,24 @@ standard_ExplainOneQuery(Query *query, int cursorOptions, bufusage_start = pgBufferUsage; INSTR_TIME_SET_CURRENT(planstart); + /* + * For CREATE MATERIALIZED VIEW command, switch to the owner'

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-06 Thread Tom Lane
Jeff Davis writes: > As you point out in the other email, it's not easy to make that all > work with REFRESH ... CONCURRENTLY, but perhaps it could work with > CREATE MATERIALIZED VIEW and REFRESH (without CONCURRENTLY). I'm not really sure I see the point of this, if it doesn

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-06 Thread Jeff Davis
not easy to make that all work with REFRESH ... CONCURRENTLY, but perhaps it could work with CREATE MATERIALIZED VIEW and REFRESH (without CONCURRENTLY). Regards, Jeff Davis

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-06 Thread Yugo Nagata
On Wed, 7 Aug 2024 02:13:04 +0900 Yugo Nagata wrote: > On Thu, 01 Aug 2024 13:34:51 -0700 > Jeff Davis wrote: > > > On Fri, 2024-08-02 at 00:13 +0500, Kirill Reshke wrote: > > > On Thu, 1 Aug 2024 at 23:27, Jeff Davis wrote: > > > > > > > > EXP

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-06 Thread Kirill Reshke
On Tue, 6 Aug 2024 at 22:13, Yugo Nagata wrote: > > On Thu, 01 Aug 2024 13:34:51 -0700 > Jeff Davis wrote: > > > On Fri, 2024-08-02 at 00:13 +0500, Kirill Reshke wrote: > > > On Thu, 1 Aug 2024 at 23:27, Jeff Davis wrote: > > > > > > > >

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-06 Thread Yugo Nagata
On Thu, 01 Aug 2024 13:34:51 -0700 Jeff Davis wrote: > On Fri, 2024-08-02 at 00:13 +0500, Kirill Reshke wrote: > > On Thu, 1 Aug 2024 at 23:27, Jeff Davis wrote: > > > > > > EXPLAIN ANALYZE CREATE MATERIALIZED VIEW doesn't go through > &g

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-06 Thread Kirill Reshke
On Tue, 6 Aug 2024 at 21:06, Yugo Nagata wrote: > > On Thu, 1 Aug 2024 23:41:18 +0500 > Kirill Reshke wrote: > > > On Thu, 1 Aug 2024 at 23:27, Jeff Davis wrote: > > > Relatedly, if we can EXPLAIN a CREATE MATERIALIZED VIEW, perhaps we > > > should be able to

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-06 Thread Yugo Nagata
On Thu, 1 Aug 2024 23:41:18 +0500 Kirill Reshke wrote: > On Thu, 1 Aug 2024 at 23:27, Jeff Davis wrote: > > Relatedly, if we can EXPLAIN a CREATE MATERIALIZED VIEW, perhaps we > > should be able to EXPLAIN a REFRESH MATERIALIZED VIEW, too? > Sure REFRESH MATERIALIZED VIEW co

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-01 Thread Jeff Davis
On Fri, 2024-08-02 at 00:13 +0500, Kirill Reshke wrote: > On Thu, 1 Aug 2024 at 23:27, Jeff Davis wrote: > > > > EXPLAIN ANALYZE CREATE MATERIALIZED VIEW doesn't go through > > ExecCreateTableAs(), but does use CreateIntoRelDestReceiver(). > > EXPLAIN ANALYZ

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-01 Thread Kirill Reshke
On Thu, 1 Aug 2024 at 23:27, Jeff Davis wrote: > > EXPLAIN ANALYZE CREATE MATERIALIZED VIEW doesn't go through > ExecCreateTableAs(), but does use CreateIntoRelDestReceiver(). EXPLAIN ANALYZE and regular query goes through create_ctas_internal (WITH NO DATA case too). Maybe we c

Re: Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-01 Thread Kirill Reshke
On Thu, 1 Aug 2024 at 23:27, Jeff Davis wrote: > Relatedly, if we can EXPLAIN a CREATE MATERIALIZED VIEW, perhaps we > should be able to EXPLAIN a REFRESH MATERIALIZED VIEW, too? Sure > Comments? Seems like this is indeed inconsistent behaviour and should be fixed in all PGDG-supported

Inconsistency with EXPLAIN ANALYZE CREATE MATERIALIZED VIEW

2024-08-01 Thread Jeff Davis
EXPLAIN ANALYZE CREATE MATERIALIZED VIEW doesn't go through ExecCreateTableAs(), but does use CreateIntoRelDestReceiver(). That bypasses the SECURITY_RESTRICTED_OPERATION in ExecCreateTableAs(). That is *not* a security problem, because the SECURITY_RESTRICTED_OPERATION in CREATE MATERIA

Re: CREATE MATERIALIZED VIEW

2024-07-29 Thread Dagfinn Ilmari Mannsåker
Nathan Bossart writes: > Committed. Thanks! - ilmari

Re: CREATE MATERIALIZED VIEW

2024-07-29 Thread Nathan Bossart
Committed. -- nathan

Re: CREATE MATERIALIZED VIEW

2024-07-25 Thread Nathan Bossart
On Thu, Jul 25, 2024 at 04:10:37PM +0100, Dagfinn Ilmari Mannsåker wrote: > Done: https://commitfest.postgresql.org/49/5139/ > > I've taken the liberty of setting you as the committer, and the target > version to 17 even though it turns out to be an older bug, since it's > arguably a follow-on fix

Re: CREATE MATERIALIZED VIEW

2024-07-25 Thread Dagfinn Ilmari Mannsåker
Nathan Bossart writes: > On Thu, Jul 25, 2024 at 03:49:02PM +0100, Dagfinn Ilmari Mannsåker wrote: >> Nathan Bossart writes: >>> However, since it looks like the feature was never actually supported in a >>> release, and the revert has been in place for over a decade, I think it'd >>> be reasona

Re: CREATE MATERIALIZED VIEW

2024-07-25 Thread Nathan Bossart
On Thu, Jul 25, 2024 at 03:49:02PM +0100, Dagfinn Ilmari Mannsåker wrote: > Nathan Bossart writes: >> However, since it looks like the feature was never actually supported in a >> release, and the revert has been in place for over a decade, I think it'd >> be reasonable to remove the tab completio

Re: CREATE MATERIALIZED VIEW

2024-07-25 Thread Dagfinn Ilmari Mannsåker
Nathan Bossart writes: > On Thu, Jul 25, 2024 at 03:09:09PM +0100, Dagfinn Ilmari Mannsåker wrote: >> Scratch that, I misread the diff. The tab completion has been there >> since matviews were added in commit 3bf3ab8c5636, but the restriction on >> unlogged matviews was added later in commit 3223

Re: CREATE MATERIALIZED VIEW

2024-07-25 Thread Nathan Bossart
On Thu, Jul 25, 2024 at 03:09:09PM +0100, Dagfinn Ilmari Mannsåker wrote: > Scratch that, I misread the diff. The tab completion has been there > since matviews were added in commit 3bf3ab8c5636, but the restriction on > unlogged matviews was added later in commit 3223b25ff73, which failed to > upd

Re: CREATE MATERIALIZED VIEW

2024-07-25 Thread Dagfinn Ilmari Mannsåker
Dagfinn Ilmari Mannsåker writes: > px shi writes: > >> Hi, I see that materialized view cannot be unlogged now, but when I use >> psql and type CREATE UNLOGGED, pressing the Tab key for auto-completion >> suggests `TABLE` and MATERIALIZED VIEW. >> Shouldn't `MATERIALIZED VIEW ` be suggested? > >

Re: CREATE MATERIALIZED VIEW

2024-07-25 Thread Dagfinn Ilmari Mannsåker
px shi writes: > Hi, I see that materialized view cannot be unlogged now, but when I use > psql and type CREATE UNLOGGED, pressing the Tab key for auto-completion > suggests `TABLE` and MATERIALIZED VIEW. > Shouldn't `MATERIALIZED VIEW ` be suggested? That's my fault, I added it in commit c951e9

CREATE MATERIALIZED VIEW

2024-07-25 Thread px shi
Hi, I see that materialized view cannot be unlogged now, but when I use psql and type CREATE UNLOGGED, pressing the Tab key for auto-completion suggests `TABLE` and MATERIALIZED VIEW. Shouldn't `MATERIALIZED VIEW ` be suggested?