Re: optionally schema-qualified for table_name

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: protodef(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: optionally schema-qualified for table_name
Date: 2020-03-22 00:13:10
Message-ID: 20200322001310.GA2031@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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(at)momjian(dot)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 +

Attachment Content-Type Size
schema.diff text/x-diff 4.8 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2020-03-22 19:05:01 Re: optionally schema-qualified for table_name
Previous Message Justin Pryzby 2020-03-21 15:15:13 Re: Add A Glossary