Re: optionally schema-qualified for table_name - Mailing list pgsql-docs

From Bruce Momjian
Subject Re: optionally schema-qualified for table_name
Date
Msg-id 20200322001310.GA2031@momjian.us
Whole thread Raw
In response to optionally schema-qualified for table_name  (PG Doc comments form <noreply@postgresql.org>)
Responses Re: optionally schema-qualified for table_name  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@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 +

Attachment

pgsql-docs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Incomplete or misleading explanation of the data types formathematical operators
Next
From: Tom Lane
Date:
Subject: Re: optionally schema-qualified for table_name