Re: [HACKERS] Permissions on copy

From: "Vadim B(dot) Mikheev" <vadim(at)sable(dot)krasnoyarsk(dot)su>
To: Jan Wieck <jwieck(at)debis(dot)com>
Cc: Brett McCormick <brett(at)work(dot)chicken(dot)org>, scrappy(at)hub(dot)org, maillist(at)candle(dot)pha(dot)pa(dot)us, Andreas(dot)Zeugswetter(at)telecom(dot)at, pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] Permissions on copy
Date: 1998-02-22 10:12:32
Message-ID: 34EFFA10.1B7B2614@sable.krasnoyarsk.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jan Wieck wrote:
>
> > either-or or just a select, so it is forced to go through the
> > executor? If we do that, what about reload the database.. it seems
> > like copy should just dump the table as-is and not do funny tricks
> > that make it impossible to COPY FROM...
>
> Good point!
>
> Currently COPY FROM does fire insert triggers. Pg_dump uses
> that and if there are triggers a restore from a pg_dump
> output with triggers active might not recreate the database
> dumped. This does not only lead to triggers, constraints are
> also object to this because reference checks implemented by
> triggers or constraints must fail if the data isn't dumped by
> pg_dump in the right order of tables. For constraints it may
> be possible (if not yet done) for pg_dump, to analyze them
> and dump the tables in the right order. But pg_dump cannot
> know what a trigger checks or what it inserts/updates/deletes
> if fired.
>
> So we need at least a switch for the COPY command restricted
> to superusers or the DB owner telling COPY to suppress
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Table owber ?

> trigger firing. Then have a look at pg_dump if it analyzes
> constraints.

1. usage: pg_dump [options] [dbname]
-a dump out only the data, no schema
-d dump data as proper insert strings
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Not only COPY should be satisfied.

2. pg_dump put triggers at the end of output -> triggers will not be
fired on restoring.

3. As for referential constraints, it's better for pg_dump to create
all tables without any of these, save data and then just use ALTER TABLE to
add constraints.

Vadim

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vadim B. Mikheev 1998-02-22 10:47:07 Re: [HACKERS] How To free resources used by large object Relations?
Previous Message Peter T Mount 1998-02-22 09:42:25 Re: [HACKERS] Open 6.3 issues