[Gllug] Why not to use MySQL...

Daniel P. Berrange dan at berrange.com
Tue Nov 25 12:45:55 UTC 2003


On Tue, Nov 25, 2003 at 12:00:46PM +0000, Richard Jones wrote:
> On Tue, Nov 25, 2003 at 11:40:14AM +0000, Sean Burlington wrote:
> > LIMIT, AUTO_INCREMENT, SHOW CREATE TABLE, SHOW TABLES
> 
> SHOW CREATE TABLE - I have no idea what this could do.

You can accomplish this using the backup pg_dump tool

eg, 

bash-2.05$ pg_dump --schema-only --table=acs_objects dan_aplaws
--
-- TOC Entry ID 2 (OID 3159687)
--
-- Name: acs_objects Type: TABLE Owner: dan
--

CREATE TABLE "acs_objects" (
        "object_id" integer NOT NULL,
	"default_domain_class" character varying(100),
	"display_name" character varying(200) NOT NULL,
        "object_type" character varying(100) NOT NULL,
	     Constraint "acs_objects_object_id_p_hhkb1" Primary Key ("object_id")
);
...snip lots of constraint definitions...
bash-2.05$

If you don't need the actual 'CREATE TABLE' definition, then a simple
describe from within psql will do:

dan_rickshaw=# \d acs_objects 
                    Table "acs_objects"
		            Column        |          Type          |
Modifiers 
----------------------+------------------------+-----------
 object_id            | integer                | not null
 object_type          | character varying(100) | not null
 display_name         | character varying(200) | not null
 default_domain_class | character varying(100) | 

Primary key: acs_objects_object_id_p_hhkb1
Triggers: RI_ConstraintTrigger_2981898,
          RI_ConstraintTrigger_2981896,
	  ...snip more triggers...

> For more detailed help, you need to read the user manuals which are
> online at http://postgresql.org.

Yes, the online documentation for PostgreSQL is really very comprehensive.
There are docs for the last 8 releases available at:

  http://www.postgresql.org/docs/
  
The 7.3 docs are:

  http://www.postgresql.org/docs/7.3/static/index.html

For details of SQL commands supported

  http://www.postgresql.org/docs/7.3/static/sql-commands.html

For info on the psql command line shell

  http://www.postgresql.org/docs/7.3/static/app-psql.html

Data types is probably another useful reference for starters:

  http://www.postgresql.org/docs/7.3/static/datatype.html

(Replace 7.3 with whatever version of PG you've got)

Dan.
-- 
|=-               http://www.berrange.com/~dan/gpgkey.txt             -=|
|=-   berrange at redhat.com  -  Daniel Berrange  -  dan at berrange.com    -=|
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20031125/391e2c1b/attachment.pgp>
-------------- next part --------------
-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug


More information about the GLLUG mailing list