pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Prefixing schema name
Date: Thu, 8 Mar 2018 09:02:30 +0200
Message-ID: <e46adbdf-07bf-2c0b-f63e-5de0f34311c2@matrix.gatewaynet.com> (raw)
In-Reply-To: <CAKFQuwYun0cHVsKhHSdOaBSMzABXYuS6JNm-VUJQLJyH8K2AFQ@mail.gmail.com>
References: <CAB_W-NN2Bx6AseZJrijUMG9M82G9Mi0sRuaUJxeh+9x+1cqp2A@mail.gmail.com>
	<CAKFQuwYun0cHVsKhHSdOaBSMzABXYuS6JNm-VUJQLJyH8K2AFQ@mail.gmail.com>

On 08/03/2018 01:13, David G. Johnston wrote:
> On Wed, Mar 7, 2018 at 4:05 PM, Tiffany Thang <tiffanythang@gmail.com <mailto:tiffanythang@gmail.com>>wrote:
>
>     ​
>     The search_path configuration works only for queries.
>
>
> ​Um....
>
> ​https://www.postgresql.org/docs/10/static/sql-createschema.html
>
> "​A CREATE command specifying an unqualified object name creates the object in the current schema (the one at the front of the search path, which can be determined with the function current_schema)"
>

In pg_dump relies heavily on search_path for all CREATE statements.

>
>     For example:
>     Is there a way to run the create/insert statements below without prefixing the schema name, user1?​
>
>
>     As the user, user1:
>     Create table user1.table1 (id int);
>     Insert into user1.table1 values (1);
>
>
> ​Just omitting "user1" and seeing what happens would be informative.  You should find it does exactly what you think - namely because the default search_path will cause "user1" to appear first.
>
> Insert is more similar to Select than it is to Create - the object being inserted into must already exist
>
> David J.
> ​​


-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

view thread (4+ messages)  latest in thread

Message-ID: <e46adbdf-07bf-2c0b-f63e-5de0f34311c2@matrix.gatewaynet.com>
Permalink:  ../e46adbdf-07bf-2c0b-f63e-5de0f34311c2@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/e46adbdf-07bf-2c0b-f63e-5de0f34311c2@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: achill@matrix.gatewaynet.com
  Subject: Re: Prefixing schema name
  In-Reply-To: <e46adbdf-07bf-2c0b-f63e-5de0f34311c2@matrix.gatewaynet.com>
  References: <CAB_W-NN2Bx6AseZJrijUMG9M82G9Mi0sRuaUJxeh+9x+1cqp2A@mail.gmail.com> <CAKFQuwYun0cHVsKhHSdOaBSMzABXYuS6JNm-VUJQLJyH8K2AFQ@mail.gmail.com> <e46adbdf-07bf-2c0b-f63e-5de0f34311c2@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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