Thread: DDL for postgres database

DDL for postgres database

From
The Hermit Hacker
Date:
---------- Forwarded message ----------
Date: Thu, 21 May 1998 14:08:33 -0400 (EDT)
From: owner-pgsql-questions@hub.org
To: owner-pgsql-questions@postgreSQL.org
Subject: BOUNCE pgsql-questions@postgreSQL.org: Approval required:

From scrappy@postgreSQL.org  Thu May 21 14:08:10 1998
Received: from ohio.bbn.com (OHIO.BBN.COM [128.89.3.251]) by hub.org (8.8.8/8.7.5) with SMTP id OAA10063 for
<questions@postgreSQL.org>;Thu, 21 May 1998 14:08:09 -0400 (EDT) 
From: nyang@bbn.com
Received: (nyang@localhost) by ohio.bbn.com (8.6.9/150.200.504) id OAA20392; Thu, 21 May 1998 14:07:02 -0400
Date: Thu, 21 May 1998 14:07:02 -0400
Message-Id: <199805211807.OAA20392@ohio.bbn.com>
To: questions@postgreSQL.org
Subject: DDL for postgres database
Cc: nyang@ohio.bbn.com
X-Sun-Charset: US-ASCII

Hi,

I have used postgres for our application.
Our customer is asking us to give them the DDL (data definition
language) files for the database.

I don't know what the customer means and feel awkward to ask them.
May be someone could give me a hint?

If anyone knows what DDL means for the postgres database,
please let me know ASAP.  Thanks a million.

Nancy


Re: [GENERAL] DDL for postgres database

From
Herouth Maoz
Date:
At 6:42 +0300 on 24/5/98, The Hermit Hacker wrote:


> Hi,
>
> I have used postgres for our application.
> Our customer is asking us to give them the DDL (data definition
> language) files for the database.
>
> I don't know what the customer means and feel awkward to ask them.
> May be someone could give me a hint?
>
> If anyone knows what DDL means for the postgres database,
> please let me know ASAP.  Thanks a million.

DDL (Data Definition language) is the part of SQL that has to do with the
definition of the data structure, as opposed to queries, insertions and
updates, which are called "Data manipulation language", if I'm not mistaken
(it is less commonly used).

In practice, this basically means all the "CREATE TABLE", "DROP TABLE",
"CREATE SEQUENCE", and I think also "CREATE INDEX", "DROP INDEX", "GRANT",
"REVOKE". In short, anything which is not "SELECT", "UPDATE" or "INSERT".

To give your clients the DDL files, what you need to do is:

pg_dump -S _database_name_

(Replace _database_name_ with the name of the database).

It would be preferable if you created the database originally using SQL
files. It's more orderly that way. You should have comments in files like
that, for example. Also, you usually use only the parts of commands like
CREATE SEQUENCE which interest you. The result of the above pg_dump gives
you all the parameters, including those which are not really relevant for
your application. However, if you just created the database and changed it
on the fly, the pg_dump will have to do.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma