Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8107807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:53:43+00:00 2026-06-06T00:53:43+00:00

I have developed an application using postgresql and it works well. Now I need

  • 0

I have developed an application using postgresql and it works well.

Now I need to create several instances of the same application but I have only one database. So I am thinking about using schemas, so that I can group each instance tables in a different schema.

Now, I wouldn’t like to rewrite all my functions and script, thus I am wondering if I can just use some directive to instruct the database to operate on a specific schema. Just to try to make it clearer, do you know when in c++ you do

using namespace std;

so that you can use cout instead of std::cout ? I would like to use someting similar if possible.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:53:45+00:00Added an answer on June 6, 2026 at 12:53 am

    The parameter you are looking for is search_path – that lists the schemas a query will look in. So, you can do something like:

    CREATE TABLE schema1.tt ...
    CREATE TABLE schema2.tt ...
    CREATE FUNCTION schema1.foo() ...
    CREATE FUNCTION schema2.foo() ...
    SET search_path = schema1, something_else;
    SELECT * FROM tt;        -- schema1.tt
    SELECT * FROM schema2.tt -- schema2.tt
    SELECT foo();            -- calls schema1.foo
    SELECT schema2.foo();    -- calls schema2.foo
    

    Note that if a query’s plan gets saved inside the body of foo() then you may get an unexpected results. I would recommend you always explicitly list schemas for referenced tables in plpgsql functions if you are using duplicated tables. If not, make sure you have testing in place to check behaviour with a chaning search_path.

    Oh – you can explicitly set search_path for a function’s body too – see the manual’s CREATE FUNCTION reference for details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed an application using J9 that runs in windows mobile. but now
I have developed a web application using Netbeans 6.7 and Ant. The webapp works,
I have developed the android phonegap application using html page and css. But My
We have developed a standalone application using visual basic 6. Now we are changing
Have developed a small Windows application using SQL Server as its database. I need
I have a developed a C++ application using 32 bit and it create a
I have developed an Android application using Eclipse which works perfectly on the Android
I have developed an application using PHP in Ubuntu XAMPP 1.7.4 environment. Now I'm
I have developed an application using Django and everything is working fine but I
I have developed a small application using MVC RC2. The application works fine in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.