diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-07-31 17:19:54 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-07-31 17:19:54 +0000 |
commit | ce7565ab91100747d250ef67d72af5c1b01150d4 (patch) | |
tree | 968d1af6054a60d13e292d786c2f695da02b2a9d /src/backend/commands/tablecmds.c | |
parent | 8be3cfbbd5e9afaa77a86251566d3ca04217fcb2 (diff) |
Instead of having a configure-time DEFAULT_ATTSTATTARGET, store -1 in
attstattarget to indicate 'use the default'. The default is now a GUC
variable default_statistics_target, and so may be changed on the fly. Along
the way we gain the ability to have pg_dump dump the per-column statistics
target when it's not the default. Patch by Neil Conway, with some kibitzing
from Tom Lane.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 6b943723bb8..cfcf5d5ddfd 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.24 2002/07/20 05:16:57 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.25 2002/07/31 17:19:51 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1668,7 +1668,7 @@ AlterTableAddColumn(Oid myrelid, attribute->attrelid = myrelid; namestrcpy(&(attribute->attname), colDef->colname); attribute->atttypid = HeapTupleGetOid(typeTuple); - attribute->attstattarget = DEFAULT_ATTSTATTARGET; + attribute->attstattarget = -1; attribute->attlen = tform->typlen; attribute->attcacheoff = -1; attribute->atttypmod = colDef->typename->typmod; @@ -2184,12 +2184,18 @@ AlterTableAlterColumnFlags(Oid myrelid, newtarget = intVal(flagValue); /* - * Limit target to sane range (should we raise an error instead?) + * Limit target to a sane range */ - if (newtarget < 0) - newtarget = 0; + if (newtarget < -1) + { + elog(ERROR, "ALTER TABLE: statistics target %d is too low", + newtarget); + } else if (newtarget > 1000) + { + elog(WARNING, "ALTER TABLE: lowering statistics target to 1000"); newtarget = 1000; + } } else if (*flagType == 'M') { |