Thread: Without schemas

Without schemas

From
Félix Sánchez Rodríguez
Date:
Greetings:
 
I'm a PHP programmer and I've had some troubles on using PostgreSQL as Database Manager. The point is that I want to know if there is anyway one can create a table without inserting inside the "public" schema. What would be desirable is that my tables could be outside any schema. Perhaps this question is almost stupid because it shows a complete lack of knowledge about PostgreSQL, but I'm really new to it. I'm using Navicat for PostgreSQL and pgAdminIII with PostgreSQL 8.1
 
Thanks in advance.

Re: Without schemas

From
Chander Ganesan
Date:
Félix Sánchez Rodríguez wrote:
> Greetings:
>
> I'm a PHP programmer and I've had some troubles on using PostgreSQL as
> Database Manager. The point is that I want to know if there is anyway
> one can create a table without inserting inside the "public" schema.
> What would be desirable is that my tables could be outside any schema.
> Perhaps this question is almost stupid because it shows a complete
> lack of knowledge about PostgreSQL, but I'm really new to it. I'm
> using Navicat for PostgreSQL and pgAdminIII with PostgreSQL 8.1
>
> Thanks in advance.
Hello Félix,

The tables you create need not be in the public schema (they may be in
another schema), but they cannot be "outside of any schema".  all tables
must be within a schema inside a database.

However, leaving things in the public schema is the closest you'll get
to what you are trying to accomplish.  You can, for the most part,
ignore the existence of schemas altogether by leaving all of your tables
in public, and referring them to the not-fully-qualified name (the table
name without the schema name).  This might be counter-intuitive if you
are looking at SQL code generated by tools such as Navicat, since those
tools fully qualify the name of all database objects (i.e.,
public.tablename, etc.) .  Doing so is not required (unless you've
changed the default search_path in your postgresql.conf file) if you
aren't using any special schemas, etc.

--
Chander Ganesan
Open Technology Group, Inc.
One Copley Parkway, Suite 210
Morrisville, NC  27560
919-463-0999/877-258-8987
http://www.otg-nc.com
Contact us about expert PostgreSQL training delivered worldwide!