public inbox for [email protected]  
help / color / mirror / Atom feed
Reserved word: OWNER
3+ messages / 3 participants
[nested] [flat]

* Reserved word: OWNER
@ 2022-05-13 07:40 PG Doc comments form <[email protected]>
  2022-05-13 12:53 ` Re: Reserved word: OWNER Thom Brown <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: PG Doc comments form @ 2022-05-13 07:40 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/sql-keywords-appendix.html
Description:

You say it's a non-reserved word, but on this page:
https://www.postgresql.org/docs/current/sql-alterdatabase.html#:~:text=To%20alter%20the%20owner%2C%2....

you clearly use OWNER as a reserved word:

ALTER DATABASE name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER |
SESSION_USER }

and if I try to use OWNER as a column name in pgAdmin, it is marked blue (ie
a reserved word). So which is it?


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Reserved word: OWNER
  2022-05-13 07:40 Reserved word: OWNER PG Doc comments form <[email protected]>
@ 2022-05-13 12:53 ` Thom Brown <[email protected]>
  2022-05-13 13:33   ` Re: Reserved word: OWNER Tom Lane <[email protected]>
  0 siblings, 1 reply; 3+ messages in thread

From: Thom Brown @ 2022-05-13 12:53 UTC (permalink / raw)
  To: [email protected]; [email protected]

On Fri, 13 May 2022 at 13:23, PG Doc comments form
<[email protected]> wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/14/sql-keywords-appendix.html
> Description:
>
> You say it's a non-reserved word, but on this page:
> https://www.postgresql.org/docs/current/sql-alterdatabase.html#:~:text=To%20alter%20the%20owner%2C%2....
>
> you clearly use OWNER as a reserved word:
>
> ALTER DATABASE name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER |
> SESSION_USER }
>
> and if I try to use OWNER as a column name in pgAdmin, it is marked blue (ie
> a reserved word). So which is it?

That sounds like a PgAdmin issue, and probably because of the way that
their syntactic highlighting works.  OWNER isn't a reserved word.

postgres=# CREATE TABLE owner (owner TEXT);
CREATE TABLE
postgres=# \d owner
              Table "public.owner"
 Column | Type | Collation | Nullable | Default
--------+------+-----------+----------+---------
 owner  | text |           |          |

Regards

Thom





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Reserved word: OWNER
  2022-05-13 07:40 Reserved word: OWNER PG Doc comments form <[email protected]>
  2022-05-13 12:53 ` Re: Reserved word: OWNER Thom Brown <[email protected]>
@ 2022-05-13 13:33   ` Tom Lane <[email protected]>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2022-05-13 13:33 UTC (permalink / raw)
  To: Thom Brown <[email protected]>; +Cc: [email protected]; [email protected]

Thom Brown <[email protected]> writes:
> On Fri, 13 May 2022 at 13:23, PG Doc comments form
>> Page: https://www.postgresql.org/docs/14/sql-keywords-appendix.html
>> if I try to use OWNER as a column name in pgAdmin, it is marked blue (ie
>> a reserved word). So which is it?

> That sounds like a PgAdmin issue, and probably because of the way that
> their syntactic highlighting works.  OWNER isn't a reserved word.

Yeah.  It is a keyword, but not a reserved one, meaning it's okay to use
as an identifier.  See the explanatory text at the top of that page.

There are actually four levels of keyword reserved-ness in Postgres,
and a simple highlighted-or-not scheme is not going to capture any of
that nuance.

			regards, tom lane






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2022-05-13 13:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 07:40 Reserved word: OWNER PG Doc comments form <[email protected]>
2022-05-13 12:53 ` Thom Brown <[email protected]>
2022-05-13 13:33   ` Tom Lane <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox