pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedoptionally schema-qualified for table_name
10+ messages / 4 participants
[nested] [flat]
* optionally schema-qualified for table_name
@ 2020-03-12 05:58 PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 10+ messages in thread
From: PG Doc comments form @ 2020-03-12 05:58 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: protodef@gmail.com
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/12/sql-altersequence.html
Description:
Although I can see that table_name in OWNED BY clause can be optionally
schema-qualified by ᅟcarefully reading "The specified table must have the
same owner and be in the same schema as the sequence.", it would be good if
"optionally schema-qualified" is explicitly noted somehow like other pages
such as CREATE TABLE and CREATE VIEW. The same applies to CREATE SEQUENCE
page.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: optionally schema-qualified for table_name
@ 2020-03-22 00:13 Bruce Momjian <bruce@momjian.us>
parent: PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 10+ messages in thread
From: Bruce Momjian @ 2020-03-22 00:13 UTC (permalink / raw)
To: protodef@gmail.com; pgsql-docs@lists.postgresql.org
On Thu, Mar 12, 2020 at 05:58:02AM +0000, PG Doc comments form wrote:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/12/sql-altersequence.html
> Description:
>
> Although I can see that table_name in OWNED BY clause can be optionally
> schema-qualified by ᅟcarefully reading "The specified table must have the
> same owner and be in the same schema as the sequence.", it would be good if
> "optionally schema-qualified" is explicitly noted somehow like other pages
> such as CREATE TABLE and CREATE VIEW. The same applies to CREATE SEQUENCE
> page.
I see what you mean. The attached patch fixes this, as well as
adjusting the error message. I didn't see any other cases.
I thought maybe the schema wasn't mentioned because the table.column
defaults to the sequence's schema, but it does not --- you have to
specify the column's schema if would not be normally be found via
search_path:
CREATE SCHEMA zz;
SET search_path = zz, public;
CREATE TABLE zz.test (x INT);
CREATE SEQUENCE zz.ss;
ALTER SEQUENCE zz.ss OWNED BY test.x;
SET search_path = public, zz;
ALTER SEQUENCE zz.ss OWNED BY test.x;
SET search_path = public;
ALTER SEQUENCE zz.ss OWNED BY test.x;
--> ERROR: relation "test" does not exist
ALTER SEQUENCE zz.ss OWNED BY zz.test.x;
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
Attachments:
schema.diff (text/x-diff, 4.8K) download
diff --git a/doc/src/sgml/ref/alter_sequence.sgml b/doc/src/sgml/ref/alter_sequence.sgml
index bfd20af6d3..b732a68d4e 100644
--- a/doc/src/sgml/ref/alter_sequence.sgml
+++ b/doc/src/sgml/ref/alter_sequence.sgml
@@ -30,7 +30,7 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable>
[ START [ WITH ] <replaceable class="parameter">start</replaceable> ]
[ RESTART [ [ WITH ] <replaceable class="parameter">restart</replaceable> ] ]
[ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ]
- [ OWNED BY { <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable> | NONE } ]
+ [ OWNED BY { [ <replaceable>schema</replaceable> . ] <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable> | NONE } ]
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> OWNER TO { <replaceable class="parameter">new_owner</replaceable> | CURRENT_USER | SESSION_USER }
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> RENAME TO <replaceable class="parameter">new_name</replaceable>
ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> SET SCHEMA <replaceable class="parameter">new_schema</replaceable>
@@ -238,7 +238,7 @@ ALTER SEQUENCE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> S
</varlistentry>
<varlistentry>
- <term><literal>OWNED BY</literal> <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable></term>
+ <term><literal>OWNED BY</literal> [ <replaceable>schema</replaceable> . ] <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable></term>
<term><literal>OWNED BY NONE</literal></term>
<listitem>
<para>
diff --git a/doc/src/sgml/ref/create_sequence.sgml b/doc/src/sgml/ref/create_sequence.sgml
index e4085804a4..cd72293df9 100644
--- a/doc/src/sgml/ref/create_sequence.sgml
+++ b/doc/src/sgml/ref/create_sequence.sgml
@@ -26,7 +26,7 @@ CREATE [ TEMPORARY | TEMP ] SEQUENCE [ IF NOT EXISTS ] <replaceable class="param
[ INCREMENT [ BY ] <replaceable class="parameter">increment</replaceable> ]
[ MINVALUE <replaceable class="parameter">minvalue</replaceable> | NO MINVALUE ] [ MAXVALUE <replaceable class="parameter">maxvalue</replaceable> | NO MAXVALUE ]
[ START [ WITH ] <replaceable class="parameter">start</replaceable> ] [ CACHE <replaceable class="parameter">cache</replaceable> ] [ [ NO ] CYCLE ]
- [ OWNED BY { <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable> | NONE } ]
+ [ OWNED BY { [ <replaceable>schema</replaceable> . ] <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable> | NONE } ]
</synopsis>
</refsynopsisdiv>
@@ -225,7 +225,7 @@ SELECT * FROM <replaceable>name</replaceable>;
</varlistentry>
<varlistentry>
- <term><literal>OWNED BY</literal> <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable></term>
+ <term><literal>OWNED BY</literal> [ <replaceable>schema</replaceable> . ] <replaceable class="parameter">table_name</replaceable>.<replaceable class="parameter">column_name</replaceable></term>
<term><literal>OWNED BY NONE</literal></term>
<listitem>
<para>
diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c
index 6aab73bfd4..f9750d2cdf 100644
--- a/src/backend/commands/sequence.c
+++ b/src/backend/commands/sequence.c
@@ -1656,7 +1656,7 @@ process_owned_by(Relation seqrel, List *owned_by, bool for_identity)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid OWNED BY option"),
- errhint("Specify OWNED BY table.column or OWNED BY NONE.")));
+ errhint("Specify OWNED BY [schema.]table.column or OWNED BY NONE.")));
tablerel = NULL;
attnum = 0;
}
diff --git a/src/test/regress/expected/sequence.out b/src/test/regress/expected/sequence.out
index 8b928b2888..e66059fd75 100644
--- a/src/test/regress/expected/sequence.out
+++ b/src/test/regress/expected/sequence.out
@@ -19,7 +19,7 @@ ERROR: CACHE (0) must be greater than zero
-- OWNED BY errors
CREATE SEQUENCE sequence_testx OWNED BY nobody; -- nonsense word
ERROR: invalid OWNED BY option
-HINT: Specify OWNED BY table.column or OWNED BY NONE.
+HINT: Specify OWNED BY [schema.]table.column or OWNED BY NONE.
CREATE SEQUENCE sequence_testx OWNED BY pg_class_oid_index.oid; -- not a table
ERROR: referenced relation "pg_class_oid_index" is not a table or foreign table
CREATE SEQUENCE sequence_testx OWNED BY pg_class.relname; -- not same schema
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: optionally schema-qualified for table_name
@ 2020-03-22 19:05 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 10+ messages in thread
From: Tom Lane @ 2020-03-22 19:05 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: protodef@gmail.com; pgsql-docs@lists.postgresql.org
Bruce Momjian <bruce@momjian.us> writes:
> I see what you mean. The attached patch fixes this, as well as
> adjusting the error message. I didn't see any other cases.
I don't really think this is an improvement, mainly because that
error message is inventing a notation that we do not use in any
other error message.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: optionally schema-qualified for table_name
@ 2020-03-22 20:15 Bruce Momjian <bruce@momjian.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 10+ messages in thread
From: Bruce Momjian @ 2020-03-22 20:15 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: protodef@gmail.com; pgsql-docs@lists.postgresql.org
On Sun, Mar 22, 2020 at 03:05:01PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > I see what you mean. The attached patch fixes this, as well as
> > adjusting the error message. I didn't see any other cases.
>
> I don't really think this is an improvement, mainly because that
> error message is inventing a notation that we do not use in any
> other error message.
What do you suggest? The current message is:
Specify OWNED BY table.column or OWNED BY NONE.
I don't see any other messages with "table.column". Do you want?
Specify OWNED BY column or OWNED BY NONE.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: optionally schema-qualified for table_name
@ 2020-03-22 22:20 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 10+ messages in thread
From: Tom Lane @ 2020-03-22 22:20 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: protodef@gmail.com; pgsql-docs@lists.postgresql.org
Bruce Momjian <bruce@momjian.us> writes:
> On Sun, Mar 22, 2020 at 03:05:01PM -0400, Tom Lane wrote:
>> I don't really think this is an improvement, mainly because that
>> error message is inventing a notation that we do not use in any
>> other error message.
> What do you suggest? The current message is:
> Specify OWNED BY table.column or OWNED BY NONE.
Yeah, and I think that's okay as-is, or at least we can't make it better
without fairly whole-sale changes of our documentation practices.
The fact that a table name can be schema-qualified is usually implicit,
and I don't see why this place cries out for making it explicit
more than other places. You could as well complain that there's
nothing explicit here about double-quoting practices.
regards, tom lane
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: optionally schema-qualified for table_name
@ 2020-03-23 01:27 Bruce Momjian <bruce@momjian.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 10+ messages in thread
From: Bruce Momjian @ 2020-03-23 01:27 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: protodef@gmail.com; pgsql-docs@lists.postgresql.org
On Sun, Mar 22, 2020 at 06:20:04PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > On Sun, Mar 22, 2020 at 03:05:01PM -0400, Tom Lane wrote:
> >> I don't really think this is an improvement, mainly because that
> >> error message is inventing a notation that we do not use in any
> >> other error message.
>
> > What do you suggest? The current message is:
>
> > Specify OWNED BY table.column or OWNED BY NONE.
>
> Yeah, and I think that's okay as-is, or at least we can't make it better
> without fairly whole-sale changes of our documentation practices.
> The fact that a table name can be schema-qualified is usually implicit,
> and I don't see why this place cries out for making it explicit
> more than other places. You could as well complain that there's
> nothing explicit here about double-quoting practices.
OK, I will do just the documentation patch for this then.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: optionally schema-qualified for table_name
@ 2020-03-24 20:35 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 10+ messages in thread
From: Peter Eisentraut @ 2020-03-24 20:35 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: protodef@gmail.com; pgsql-docs@lists.postgresql.org
On 2020-03-23 02:27, Bruce Momjian wrote:
> On Sun, Mar 22, 2020 at 06:20:04PM -0400, Tom Lane wrote:
>> Bruce Momjian <bruce@momjian.us> writes:
>>> On Sun, Mar 22, 2020 at 03:05:01PM -0400, Tom Lane wrote:
>>>> I don't really think this is an improvement, mainly because that
>>>> error message is inventing a notation that we do not use in any
>>>> other error message.
>>
>>> What do you suggest? The current message is:
>>
>>> Specify OWNED BY table.column or OWNED BY NONE.
>>
>> Yeah, and I think that's okay as-is, or at least we can't make it better
>> without fairly whole-sale changes of our documentation practices.
>> The fact that a table name can be schema-qualified is usually implicit,
>> and I don't see why this place cries out for making it explicit
>> more than other places. You could as well complain that there's
>> nothing explicit here about double-quoting practices.
>
> OK, I will do just the documentation patch for this then.
The same criticism applies to the documentation patch, I think. We
don't usually make the schema part explicit.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: optionally schema-qualified for table_name
@ 2020-03-24 20:58 Bruce Momjian <bruce@momjian.us>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 1 reply; 10+ messages in thread
From: Bruce Momjian @ 2020-03-24 20:58 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; protodef@gmail.com; pgsql-docs@lists.postgresql.org
On Tue, Mar 24, 2020 at 09:35:25PM +0100, Peter Eisentraut wrote:
> On 2020-03-23 02:27, Bruce Momjian wrote:
> > On Sun, Mar 22, 2020 at 06:20:04PM -0400, Tom Lane wrote:
> > > Bruce Momjian <bruce@momjian.us> writes:
> > > > On Sun, Mar 22, 2020 at 03:05:01PM -0400, Tom Lane wrote:
> > > > > I don't really think this is an improvement, mainly because that
> > > > > error message is inventing a notation that we do not use in any
> > > > > other error message.
> > >
> > > > What do you suggest? The current message is:
> > >
> > > > Specify OWNED BY table.column or OWNED BY NONE.
> > >
> > > Yeah, and I think that's okay as-is, or at least we can't make it better
> > > without fairly whole-sale changes of our documentation practices.
> > > The fact that a table name can be schema-qualified is usually implicit,
> > > and I don't see why this place cries out for making it explicit
> > > more than other places. You could as well complain that there's
> > > nothing explicit here about double-quoting practices.
> >
> > OK, I will do just the documentation patch for this then.
>
> The same criticism applies to the documentation patch, I think. We don't
> usually make the schema part explicit.
That is a good point. I used CREATE VIEW as an example because that is
what the user reported, but it seems only create_view and reindexed use
a schema name qualification:
$ grep -l '<replaceable>schema</replaceable>' *.sgml
create_view.sgml
reindexdb.sgml
The reindexdb use is because of -S (reindex schema), which makes sense.
The create view case is used in an example of CREATE RECURSIVE VIEW and
should probably be removed.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: optionally schema-qualified for table_name
@ 2020-03-25 12:46 Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 10+ messages in thread
From: Peter Eisentraut @ 2020-03-25 12:46 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; protodef@gmail.com; pgsql-docs@lists.postgresql.org
On 2020-03-24 21:58, Bruce Momjian wrote:
> That is a good point. I used CREATE VIEW as an example because that is
> what the user reported, but it seems only create_view and reindexed use
> a schema name qualification:
>
> $ grep -l '<replaceable>schema</replaceable>' *.sgml
> create_view.sgml
> reindexdb.sgml
>
> The reindexdb use is because of -S (reindex schema), which makes sense.
> The create view case is used in an example of CREATE RECURSIVE VIEW and
> should probably be removed.
The CREATE RECURSIVE VIEW example is making a specific point about
schema qualification, which is explained below the example.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: optionally schema-qualified for table_name
@ 2020-03-25 20:10 Bruce Momjian <bruce@momjian.us>
parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
0 siblings, 0 replies; 10+ messages in thread
From: Bruce Momjian @ 2020-03-25 20:10 UTC (permalink / raw)
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; protodef@gmail.com; pgsql-docs@lists.postgresql.org
On Wed, Mar 25, 2020 at 01:46:54PM +0100, Peter Eisentraut wrote:
> On 2020-03-24 21:58, Bruce Momjian wrote:
> > That is a good point. I used CREATE VIEW as an example because that is
> > what the user reported, but it seems only create_view and reindexed use
> > a schema name qualification:
> >
> > $ grep -l '<replaceable>schema</replaceable>' *.sgml
> > create_view.sgml
> > reindexdb.sgml
> >
> > The reindexdb use is because of -S (reindex schema), which makes sense.
> > The create view case is used in an example of CREATE RECURSIVE VIEW and
> > should probably be removed.
>
> The CREATE RECURSIVE VIEW example is making a specific point about schema
> qualification, which is explained below the example.
OK, so I guess everything is fine and we can just go back to other
business. :-) Sorry for the distraction.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EnterpriseDB https://enterprisedb.com
+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2020-03-25 20:10 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 05:58 optionally schema-qualified for table_name PG Doc comments form <noreply@postgresql.org>
2020-03-22 00:13 ` Bruce Momjian <bruce@momjian.us>
2020-03-22 19:05 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-03-22 20:15 ` Bruce Momjian <bruce@momjian.us>
2020-03-22 22:20 ` Tom Lane <tgl@sss.pgh.pa.us>
2020-03-23 01:27 ` Bruce Momjian <bruce@momjian.us>
2020-03-24 20:35 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2020-03-24 20:58 ` Bruce Momjian <bruce@momjian.us>
2020-03-25 12:46 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2020-03-25 20:10 ` Bruce Momjian <bruce@momjian.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox