pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedHow to execute .sql file inside a postgres schema
3+ messages / 3 participants
[nested] [flat]
* How to execute .sql file inside a postgres schema
@ 2019-04-29 14:02 Daulat Ram <Daulat.Ram@exponential.com>
2019-04-29 14:52 ` Re: How to execute .sql file inside a postgres schema Daniel Westermann (DWE) <daniel.westermann@dbi-services.com>
2019-04-29 19:16 ` Re: How to execute .sql file inside a postgres schema Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 2 replies; 3+ messages in thread
From: Daulat Ram @ 2019-04-29 14:02 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Hello team,
I have a database name "kbdb" that is having a schema "kb" and I want to execute the test.sql file inside this schema,
Please help how we can do that.
Regards,
Daulat
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: How to execute .sql file inside a postgres schema
2019-04-29 14:02 How to execute .sql file inside a postgres schema Daulat Ram <Daulat.Ram@exponential.com>
@ 2019-04-29 14:52 ` Daniel Westermann (DWE) <daniel.westermann@dbi-services.com>
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Westermann (DWE) @ 2019-04-29 14:52 UTC (permalink / raw)
To: Daulat Ram <Daulat.Ram@exponential.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
>>I have a database name “kbdb” that is having a schema “kb” and I want to execute the test.sql file inside >>this schema,
set schema 'your_schema';
Cheers,
Daniel
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: How to execute .sql file inside a postgres schema
2019-04-29 14:02 How to execute .sql file inside a postgres schema Daulat Ram <Daulat.Ram@exponential.com>
@ 2019-04-29 19:16 ` Adrian Klaver <adrian.klaver@aklaver.com>
1 sibling, 0 replies; 3+ messages in thread
From: Adrian Klaver @ 2019-04-29 19:16 UTC (permalink / raw)
To: Daulat Ram <Daulat.Ram@exponential.com>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
On 4/29/19 7:02 AM, Daulat Ram wrote:
> Hello team,
>
> I have a database name “kbdb” that is having a schema “kb” and I want to
> execute the test.sql file inside this schema,
>
> Please help how we can do that.
You can do as Daniel suggested but be aware that it is equivalent to:
https://www.postgresql.org/docs/11/sql-set.html
SET search_path TO value
That means if you have objects in the script that are not schema
qualified and need to point to other schemas then things will fail. A
longer term solution would to schema qualify the objects in your script.
This is assuming that the script is not generic and is meant to 'float'
from schema to schema.
>
> Regards,
>
> Daulat
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2019-04-29 19:16 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-04-29 14:02 How to execute .sql file inside a postgres schema Daulat Ram <Daulat.Ram@exponential.com>
2019-04-29 14:52 ` Daniel Westermann (DWE) <daniel.westermann@dbi-services.com>
2019-04-29 19:16 ` Adrian Klaver <adrian.klaver@aklaver.com>
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