Обсуждение: changing a definition in a dump file?

Поиск
Список
Период
Сортировка

changing a definition in a dump file?

От
"postgresql"
Дата:
Hi all,
I think I inadvertently sent this to pg-admin...

Is it possible to change the definitions in the dump file to alter a 
table.

this is from my  pgdump file:

CREATE TABLE "fc_client_info" (
   "acode" character varying(12),
   "cname" character varying(32)
);

If I change the file to read:

CREATE TABLE "fc_client_info" (
   "acode" character varying(12),
   "cname" character varying(128)
);

Can I drop the database and read in the altered pgdump file to effect the 
change?

Thanks for your time.

Ted




Re: changing a definition in a dump file?

От
Stephan Szabo
Дата:
On Fri, 18 Jan 2002, postgresql wrote:

> Hi all,
> I think I inadvertently sent this to pg-admin...
>
> Is it possible to change the definitions in the dump file to alter a
> table.
>
> this is from my �pgdump file:
>
> CREATE TABLE "fc_client_info" (
> � �"acode" character varying(12),
> � �"cname" character varying(32)
> );
>
> If I change the file to read:
>
> CREATE TABLE "fc_client_info" (
> � �"acode" character varying(12),
> � �"cname" character varying(128)
> );
>
> Can I drop the database and read in the altered pgdump file to effect the
> change?

A dropdb, createdb, read pgdump should do what you want in this case.
In general you need to be sure that the data works for the changes
you're making but lengthening a varchar should be fine.




Conditionally create table problem

От
Wei Weng
Дата:
Is there better way to conditionally create tables rather than doing
SELECT sp_CheckTable_tablename(); ?

(In sp_CheckTable_tablename, we will basically query the pg_tables and
create the table if it doesn't exists and do nothing it it does.)

TIA.

-- 
Wei Weng
Network Software Engineer
KenCast Inc.