You are here: Re: No phpPgAdmin delete or edit links when browsing « PHP Programming Language « IT news, forums, messages
Re: No phpPgAdmin delete or edit links when browsing

Posted by Toby A Inkster on 01/30/08 16:26

Dan99 wrote:

> SELECT * INTO table2 FROM table
> This works well except for the fact that it doesnt copy anything but the
> data. For example any indexes, constraints, or triggers do not copy to
> the new table? How would I go about making an exact duplicate of a
> table?

CREATE TABLE foo (LIKE bar INCLUDING DEFAULTS INCLUDING CONSTRAINTS);
INSERT INTO foo SELECT * FROM bar;

This will copy the table structure, data and constraints, but not indexes
or triggers. If you want to make sure that indexes and triggers are
copied, probably the best route is to use the pg_dump backup tool that
comes with PostgreSQL to dump the table in its entirety to a flat SQL
file, which can then be opened with a text editor to change the table name
and then restored.

I suggest continuing this discussion in comp.databases.postgresql.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 22:33.]

Looking Ahead to PHP 6
http://tobyinkster.co.uk/blog/2008/01/29/php6/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация