~ubuntu-branches/ubuntu/lucid/postgresql-8.4/lucid-proposed

« back to all changes in this revision

Viewing changes to src/backend/commands/tablecmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt, Peter Eisentraut, Martin Pitt
  • Date: 2009-12-14 19:02:38 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20091214190238-ubwqbnzwbhbc9b9f
Tags: 8.4.2-1
Medium urgency due to security fixes.

[ Peter Eisentraut ]
* debian/control: Added Homepage
* debian/control: Added ${misc:Depends} on all packages, per lintian
* debian/control: Added versioned dependencies on the shared libraries used 
  by the libecpg-dev package
* debian/control: Removed obsolete build dependency bzip2
* debian/control: Added Vcs fields

[ Martin Pitt ]
* New upstream security/bug fix release:
  - Protect against indirect security threats caused by index functions
    changing session-local state. This change prevents allegedly-immutable
    index functions from possibly subverting a superuser's session
    (CVE-2009-4136).
  - Reject SSL certificates containing an embedded null byte in the
    common name (CN) field. This prevents unintended matching of a
    certificate to a server or client name during SSL validation
    (CVE-2009-4034).
  - Fix hash index corruption. The 8.4 change that made hash indexes keep
    entries sorted by hash value failed to update the bucket splitting and
    compaction routines to preserve the ordering. So application of either
    of those operations could lead to permanent corruption of an index, in
    the sense that searches might fail to find entries that are present. To
    deal with this, it is recommended to REINDEX any hash indexes you may
    have after installing this update.
  - Fix possible crash during backend-startup-time cache initialization.
  - Avoid crash on empty thesaurus dictionary.
  - Prevent signals from interrupting VACUUM at unsafe times.
  - Fix possible crash due to integer overflow in hash table size
    calculation.
  - Fix crash if a DROP is attempted on an internally-dependent object.
  - Fix very rare crash in inet/cidr comparisons.
  - Ensure that shared tuple-level locks held by prepared transactions
    are not ignored.
  - Fix premature drop of temporary files used for a cursor that is
    accessed within a subtransaction.
  - Fix memory leak in syslogger process when rotating to a new CSV
    logfile.
  - Fix memory leak in postmaster when re-parsing "pg_hba.conf".
  - Make FOR UPDATE/SHARE in the primary query not propagate into WITH
    queries.
  - Fix bug with a WITH RECURSIVE query immediately inside another one.
  - Fix concurrency bug in hash indexes.
  - Fix incorrect logic for GiST index page splits, when the split
    depends on a non-first column of the index.
  - Fix wrong search results for a multi-column GIN index with
    fastupdate enabled.
  - Fix bugs in WAL entry creation for GIN indexes.
  - Don't error out if recycling or removing an old WAL file fails at
    the end of checkpoint.
  - Fix PAM password processing to be more robust.
    The previous code is known to fail with the combination of the
    Linux pam_krb5 PAM module with Microsoft Active Directory as the
    domain controller. It might have problems elsewhere too, since it
    was making unjustified assumptions about what arguments the PAM
    stack would pass to it.
  - Raise the maximum authentication token (Kerberos ticket) size in
    GSSAPI and SSPI authentication methods. While the old 2000-byte limit
    was more than enough for Unix Kerberos implementations, tickets issued
    by Windows Domain Controllers can be much larger.
  - Ensure that domain constraints are enforced in constructs like
    ARRAY[...]::domain, where the domain is over an array type.
  - Fix foreign-key logic for some cases involving composite-type
    columns as foreign keys.
  - Ensure that a cursor's snapshot is not modified after it is created.
  - Fix CREATE TABLE to properly merge default expressions coming from
    different inheritance parent tables. This used to work but was broken in
    8.4.
  - Re-enable collection of access statistics for sequences. This used to
    work but was broken in 8.3.
  - Fix processing of ownership dependencies during CREATE OR REPLACE
    FUNCTION.
  - Fix incorrect handling of WHERE "x"="x" conditions.
    In some cases these could get ignored as redundant, but they aren't
    -- they're equivalent to "x" IS NOT NULL.
  - Fix incorrect plan construction when using hash aggregation to
    implement DISTINCT for textually identical volatile expressions
  - Fix Assert failure for a volatile SELECT DISTINCT ON expression
  - Fix ts_stat() to not fail on an empty tsvector value
  - Make text search parser accept underscores in XML attributes
  - Fix encoding handling in xml binary input.
    If the XML header doesn't specify an encoding, we now assume UTF-8
    by default; the previous handling was inconsistent.
  - Fix bug with calling plperl from plperlu or vice versa.
  - Fix session-lifespan memory leak when a PL/Perl function is
    redefined.
  - Ensure that Perl arrays are properly converted to PostgreSQL arrays
    when returned by a set-returning PL/Perl function.
  - Fix rare crash in exception processing in PL/Python.
  - Fix ecpg problem with comments in DECLARE CURSOR statements
  - Fix ecpg to not treat recently-added keywords as reserved words
    This affected the keywords CALLED, CATALOG, DEFINER, ENUM,
    FOLLOWING, INVOKER, OPTIONS, PARTITION, PRECEDING, RANGE, SECURITY,
    SERVER, UNBOUNDED, and WRAPPER.
  - Re-allow regular expression special characters in psql's \df
    function name parameter.
  - Put FREEZE and VERBOSE options in the right order in the VACUUM
    command that "contrib/vacuumdb" produces.
  - Fix possible leak of connections when "contrib/dblink" encounters
    an error
  - Make the postmaster ignore any application_name parameter in
    connection request packets, to improve compatibility with future
    libpq versions.
* debian/control: libreadline5-dev → libreadline-dev. (Closes: #553831)
* Add 03-sh-architecture.patch: Support Renesas' SuperH architecture, thanks
  Nobuhiro Iwamatsu! (Closes: #548847)

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 *
9
9
 *
10
10
 * IDENTIFICATION
11
 
 *        $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.288.2.1 2009/08/07 15:28:07 tgl Exp $
 
11
 *        $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.288.2.3 2009/12/09 21:58:04 tgl Exp $
12
12
 *
13
13
 *-------------------------------------------------------------------------
14
14
 */
370
370
                                 errmsg("ON COMMIT can only be used on temporary tables")));
371
371
 
372
372
        /*
 
373
         * Security check: disallow creating temp tables from security-restricted
 
374
         * code.  This is needed because calling code might not expect untrusted
 
375
         * tables to appear in pg_temp at the front of its search path.
 
376
         */
 
377
        if (stmt->relation->istemp && InSecurityRestrictedOperation())
 
378
                ereport(ERROR,
 
379
                                (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
 
380
                                 errmsg("cannot create temporary table within security-restricted operation")));
 
381
 
 
382
        /*
373
383
         * Look up the namespace in which we are supposed to create the relation.
374
384
         * Check we have permission to create there. Skip check if bootstrapping,
375
385
         * since permissions machinery may not be working yet.
486
496
                        cooked->contype = CONSTR_DEFAULT;
487
497
                        cooked->name = NULL;
488
498
                        cooked->attnum = attnum;
489
 
                        cooked->expr = stringToNode(colDef->cooked_default);
 
499
                        cooked->expr = colDef->cooked_default;
490
500
                        cooked->is_local = true;        /* not used for defaults */
491
501
                        cooked->inhcount = 0;           /* ditto */
492
502
                        cookedDefaults = lappend(cookedDefaults, cooked);
1136
1146
        List       *constraints = NIL;
1137
1147
        int                     parentsWithOids = 0;
1138
1148
        bool            have_bogus_defaults = false;
1139
 
        char       *bogus_marker = "Bogus!";            /* marks conflicting defaults */
1140
1149
        int                     child_attno;
 
1150
        static Node     bogus_marker = { 0 };           /* marks conflicting defaults */
1141
1151
 
1142
1152
        /*
1143
1153
         * Check for and reject tables with too many columns. We perform this
1321
1331
                         */
1322
1332
                        if (attribute->atthasdef)
1323
1333
                        {
1324
 
                                char       *this_default = NULL;
 
1334
                                Node       *this_default = NULL;
1325
1335
                                AttrDefault *attrdef;
1326
1336
                                int                     i;
1327
1337
 
1332
1342
                                {
1333
1343
                                        if (attrdef[i].adnum == parent_attno)
1334
1344
                                        {
1335
 
                                                this_default = attrdef[i].adbin;
 
1345
                                                this_default = stringToNode(attrdef[i].adbin);
1336
1346
                                                break;
1337
1347
                                        }
1338
1348
                                }
1350
1360
                                 */
1351
1361
                                Assert(def->raw_default == NULL);
1352
1362
                                if (def->cooked_default == NULL)
1353
 
                                        def->cooked_default = pstrdup(this_default);
1354
 
                                else if (strcmp(def->cooked_default, this_default) != 0)
 
1363
                                        def->cooked_default = this_default;
 
1364
                                else if (!equal(def->cooked_default, this_default))
1355
1365
                                {
1356
 
                                        def->cooked_default = bogus_marker;
 
1366
                                        def->cooked_default = &bogus_marker;
1357
1367
                                        have_bogus_defaults = true;
1358
1368
                                }
1359
1369
                        }
1492
1502
                {
1493
1503
                        ColumnDef  *def = lfirst(entry);
1494
1504
 
1495
 
                        if (def->cooked_default == bogus_marker)
 
1505
                        if (def->cooked_default == &bogus_marker)
1496
1506
                                ereport(ERROR,
1497
1507
                                                (errcode(ERRCODE_INVALID_COLUMN_DEFINITION),
1498
1508
                                  errmsg("column \"%s\" inherits conflicting default values",