public inbox for [email protected]  
help / color / mirror / Atom feed
Tables in public schema
4+ messages / 3 participants
[nested] [flat]

* Tables in public schema
@ 2025-05-27 14:01 Edwin UY <[email protected]>
  2025-05-27 14:11 ` Re: Tables in public schema David G. Johnston <[email protected]>
  2025-05-27 15:31 ` Re: Tables in public schema Ron Johnson <[email protected]>
  0 siblings, 2 replies; 4+ messages in thread

From: Edwin UY @ 2025-05-27 14:01 UTC (permalink / raw)
  To: Pgsql-admin <[email protected]>

Hi,

In one of the PostgreSQL Instances, I just found out that the tables are
created in the public schema even though there is a user database.
New tables are also getting created in the public schema.
There is no non-public schema when I run \dn, it only shows public.
I assume this is a risk of some sort and want to create a user schema and
move them from public to the new schema.
Will I have to redo the grants?

Regards,
Ed


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

* Re: Tables in public schema
  2025-05-27 14:01 Tables in public schema Edwin UY <[email protected]>
@ 2025-05-27 14:11 ` David G. Johnston <[email protected]>
  2025-05-27 15:33   ` Re: Tables in public schema Ron Johnson <[email protected]>
  1 sibling, 1 reply; 4+ messages in thread

From: David G. Johnston @ 2025-05-27 14:11 UTC (permalink / raw)
  To: Edwin UY <[email protected]>; +Cc: Pgsql-admin <[email protected]>

On Tue, May 27, 2025 at 7:02 AM Edwin UY <[email protected]> wrote:

> Will I have to redo the grants?
>

If you use "alter table set schema" the table OID will not change and the
grants should follow it.  Users would be subject to whatever new
permissions apply to the newly created schema rather than the public schema
though.

David J.


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

* Re: Tables in public schema
  2025-05-27 14:01 Tables in public schema Edwin UY <[email protected]>
  2025-05-27 14:11 ` Re: Tables in public schema David G. Johnston <[email protected]>
@ 2025-05-27 15:33   ` Ron Johnson <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Ron Johnson @ 2025-05-27 15:33 UTC (permalink / raw)
  To: Pgsql-admin <[email protected]>

On Tue, May 27, 2025 at 10:12 AM David G. Johnston <
[email protected]> wrote:

> On Tue, May 27, 2025 at 7:02 AM Edwin UY <[email protected]> wrote:
>
>> Will I have to redo the grants?
>>
>
> If you use "alter table set schema" the table OID will not change and the
> grants should follow it.  Users would be subject to whatever new
> permissions apply to the newly created schema rather than the public schema
> though.
>

 And he'll either have to SET SEARCH_PATH or manually qualify every CREATE
TABLE statement with the correct schema name.

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!


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

* Re: Tables in public schema
  2025-05-27 14:01 Tables in public schema Edwin UY <[email protected]>
@ 2025-05-27 15:31 ` Ron Johnson <[email protected]>
  1 sibling, 0 replies; 4+ messages in thread

From: Ron Johnson @ 2025-05-27 15:31 UTC (permalink / raw)
  To: Edwin UY <[email protected]>; Pgsql-admin <[email protected]>

On Tue, May 27, 2025 at 10:02 AM Edwin UY <[email protected]> wrote:

> Hi,
>
> the tables are created in the public schema *even though there is a user
> database.*
>

schemata are subsidiary to databases.  Every table *must* be created in
*some* schema.

-- 
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!


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


end of thread, other threads:[~2025-05-27 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-05-27 14:01 Tables in public schema Edwin UY <[email protected]>
2025-05-27 14:11 ` David G. Johnston <[email protected]>
2025-05-27 15:33   ` Ron Johnson <[email protected]>
2025-05-27 15:31 ` Ron Johnson <[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