Обсуждение: Re: Pseudo modification of views and triggers (

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

Re: Pseudo modification of views and triggers (

От
Dave Page
Дата:

> -----Original Message-----
> From: Jean-Michel POURE [mailto:jm.poure@freesurf.fr]
> Sent: 19 February 2002 21:19
> To: Dave Page
> Cc: pgadmin-hackers@postgresql.org
> Subject: Re: [pgadmin-hackers] Pseudo modification of views
> and triggers (again)
>
>
> > I've just found out that views can be renamed using ALTER TABLE
> > <viewname> RENAME... iirc, VIEWs are referred to by OID from PL/SQL
> > functions & other views, and by name from pl/pgsql functions.
> OK. Since we can modify PL/pgSQL functions, it is no problem.
> It is a pitty we don't have CREATE OR REPLACE VIEW anyway.

Yes, it is. The beauty of the code we've written though, is that it will
take minutes to convert to CREATE OR REPLACE when it is available.

> > Sequences can also be renamed in this way.
> Great. It also works for indexes. So interesting.

Does it? I wasn't aware of that.

> > Triggers could be implemented exactly as Views. Each property will
> > need to be handled seperately, though in the future we
> might look into
> > merging multiple updates into one.
> Can we rename a trigger with ALTER TABLE RENAME ?

Doubtful. I believe ALTER TABLE works for sequences & views because they
live in pg_class. I guess ALTER TABLE RENAME just doesn't check or care
about relkind.

> > The Name property must be handled differently (as it would be for
> > Views &
> > Sequences) in the Collection class. This has already been
> done for tables,
> > so there is some example code to steal.
> You already did 99% of the job and I wron't complain about it.
>
> The next big thing now is table pseudo-modification. We
> should be able to
> provide a very nice solution.

Hopefully, but let's get Views & Triggers nailed first.

BTW, have you been following the discussion on pgsql-hackers about the
ongoing pl/pgSQL drop column code?

Regards, Dave.

Re: Pseudo modification of views and triggers ( again)

От
Jean-Michel POURE
Дата:
Le Mercredi 20 Février 2002 09:17, Dave Page a écrit :
> BTW, have you been following the discussion on pgsql-hackers about the
> ongoing pl/pgSQL drop column code?

Yes, sounds interesting but the code will probably be very close to ours.
But, didn't we say no PL/pgSQL in our previous discussions? pgAdmin2 is
intended for a large audience, so better if no PL/pgSQL is required.

What I see in pgSchema is a powerfull pseudo "CREATE TABLE foo_new AS"
clause to copy schema information with selected linked objects (indexes,
columns, primary key, triggers, rules, etc...). We only have to move data
between tables, drop the old table and rename the new one.

This is more powerfull than hidding deleted columns AND it can be used to
reorder columns.

By the way, there seems to be anoyther way to modify a primary key : create a
unique index foo_new, drop the primary key foo,  and rename foo_new to foo.
What do you think?

Cheers,
Jean-Michel