what is the difference between schemas and catalogs?

Posted on 2008-10-24
Last Modified: 2012-05-05
hello experts,
i'm using pgAdmin to interface postgresql,

i've create databases, my databases contains: schemas and catalogs,
but inside a schema there's the same elements than in a catalog:
Aggregates,  Domains, Functions, Sequences, Tables, Trigger Functions, Types, Views.  

what is the  difference between the two?
Question by:toshi_
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 12

Assisted Solution

hfraser earned 350 total points
ID: 22796149
Catalogs are simply tables (like any other) that contain information about the database, like tables, indices, operators, functions. data types, etc.. Since Postgres is extensible, this information (like new data types) is cntabined in tables you can add too, rather than coded into the engine directly.

Schemas is a namespace. It contains catalogs and tables, but is separate from other schemas, allowing multiple definitions for a new data type or function to be used within the same database. You might, for instance, have development environments for two groups hosted on the same database, but kept in different schemas to prevent naming conflicts.

Author Comment

ID: 22797276
as i see it in pgAdmin,
there's just the icon that is different,


Author Comment

ID: 22797287
what could i do in schemas that i can not do in catalogs and vice-versa?

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

LVL 12

Accepted Solution

hfraser earned 350 total points
ID: 22798444
Remember that Postgres is extensible, meaning that you can define new datatypes, operators, functions, etc.. These extensions are not like an attribute of a table; they are completely new types of data (like the standard int, text, float, etc.) and the operators that work on them (like +,-,/,*).that apply to any queries, tables, etc.. So if you've created a new datatype called widget, you're free to create a table with an attribute in it called widget, re-define the "+" function to do something meaningful when you add two widgets.

But maybe someone else has another project that defines their own datatype called widget. Schemas allow you to have multiple sets of these extensions within Postgres. Depending upon which schema you choose to use, you will inherit the extensions defined in that schema. By creating separate schemas for each of these environments, you can support both definitions.

My example's a bit lame, but hopefully it gets the idea across. Most uses of Postgres I've seen never delve into extensions, and don't use schemas.

Author Comment

ID: 22810544

Most uses of Postgres I've seen never delve into extensions, and don't use schemas.?

so what do they do?

LVL 12

Assisted Solution

hfraser earned 350 total points
ID: 22811040
Use it as a standard database out of the box The extensions and schema support are only necessary if the standard offerings don't meet your requirements.

Assisted Solution

brycen earned 150 total points
ID: 22860175
With schemas, you can create separate namespaces:
bnesbitt=> create table foo (foo_key integer, foo_text varchar(1024));
bnesbitt=> create schema api2;
bnesbitt=> create table (foo_key integer, foo_int integer);
Here "select * from;" returns different results from "select * from foo" (which is really "select * from".  The default schema is called "public".

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Best database to use for Maps is PostgreSQL. This is an open source database. Comes as a package with most Linux OS. For more info visit the following site: ( This requires some add-o…
Many developers have database experience, but are new to PostgreSQL. It has some truly inspiring capabilities. I have several years' experience with Microsoft's SQL Server. When I began working with MySQL, I wanted a quick-reference to MySQL (htt…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question