Re: DROP/CREATE

From: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>
To: pgadmin-hackers(at)postgresql(dot)org
Subject: Re: DROP/CREATE
Date: 2001-10-22 07:11:07
Message-ID: AA30E7BCCA5C1D4E88A231900F8325C00BD2@dogbert.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

> -----Original Message-----
> From: Jean-Michel POURE [mailto:jm(dot)poure(at)freesurf(dot)fr]
> Sent: 21 October 2001 15:27
> To: pgadmin-hackers(at)postgresql(dot)org
> Cc: dpage(at)vale-housing(dot)co(dot)uk
> Subject: DROP/CREATE
>
>
> Hello Dave and all,
>
> Views are based on OIDs and there is not simple way to implement
> DROP/CREATE VIEW in pgAdmin II. Seems more easy for CREATE OR REPLACE
> TRIGGER. I posted today a mail on pg-hackers to ask if someone could
> implement CREATE OR REPLACE directly in PostgreSQL.

Yes, I saw your email. Actually, editting a view in pgSchema is probably not
that hard as pgSchema doesn't give two hoots about the change in OID - what
is more difficult is renaming an object or changing anything that would
affect the .Identifier property. In reality, the biggest issue with this in
pgSchema is probably that no dependency checking will be done. For a
'standalone' view, this is fine, but if the view is used in another view or
a function then that will break (I think I'm teaching my Grandmother to suck
eggs here Jean-Michel!).

To edit a view in pgSchema, a Public Property Definition(vData As String) is
required in pgView.cls. This will:

1) Attempt to create a view with the new definition to ensure it's valid.
2) Drop the old view.
3) Create the new view.
4) Re-apply any comments and ACLs.
5) Query pg_class for the updated OID.

Job's done! Actually, probably the hardest bit is resetting the ACL. In
theory, the same could be achieved for Triggers, although you wouldn't be
able to change the Table.

In other news:

- pgadmin.org is now registered. It's (well, www.pgadmin.org) setup
currently with frames based forwarding to pgadmin.postgresql.org.

- pgAdmin II has now been run and (not extensively) tested on Windows XP
Professional (release version). All seems OK...

Cheers, Dave.

Browse pgadmin-hackers by date

  From Date Subject
Next Message Bill Studenmund 2001-10-22 18:45:04 Re: [HACKERS] CREATE OR REPLACE VIEW/TRIGGER
Previous Message Jean-Michel POURE 2001-10-21 14:27:24 DROP/CREATE