D'Arcy J.M. Cain wrote:
> Actually, there is another way to do this. If the system were to always
> generate a sequential number on insert and ignore any value specified, that
> would work to. Unfortunately that wouldn't work on a dump and restore.
The way I described it, using a kind of pre-rewriting, would
work for dump/restore. Data moved in by COPY doesn't invoke
any rule since there is no query to rewrite (except you dump
it as INSERT statements). COPY is a utility statement and
they aren't rewritten at all. On the other hand we could
change pg_dump to omit SERIAL and CONSTRAINT information at
CREATE TABLE and later turn all this on like triggers/rules
(using ALTER TABLE?) when the data is put back by
COPY/INSERT.
I think for 6.5 it would also be good to restrict the use of
COPY to tables the user has RULE permissions for. I think
such a check doesn't exist already and if I'm right, COPY is
a way to get around rules ON INSERT.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#======================================== jwieck@debis.com (Jan Wieck) #