Re: DB & Schema

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: "md(at)rpzdesign(dot)com" <md(at)rpzdesign(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: DB & Schema
Date: 2012-09-21 16:15:25
Message-ID: 505C929D.5070400@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 21.09.2012 17:58, md(at)rpzdesign(dot)com wrote:
> During the execution of ProcessUtility() function in
> /src/backend/xxx/utility.c,
>
> the CreateStmt node type is processed to create a table.
>
> Is there a global function in the context of the backend process that
> will deliver what the current database and schema names?

There's a global variable MyDatabaseId for the database the backend is
connected to. It doesn't change after login.

There's no such thing as a "current schema", but I think you'll want to
take a look at src/backend/catalog/namespace.c, which handles the
search_path. There's a variable activeCreationNamespace there; look at
the functions in namespace.c to see how it works.

- Heikki

In response to

  • DB & Schema at 2012-09-21 14:58:48 from md@rpzdesign.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-09-21 16:16:36 Re: 64-bit API for large object
Previous Message Karl O. Pinc 2012-09-21 15:54:05 Re: Suggestion for --truncate-tables to pg_restore