~ubuntu-branches/ubuntu/trusty/postgresql-8.4/trusty

« back to all changes in this revision

Viewing changes to src/backend/executor/execMain.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-11 16:59:35 UTC
  • mfrom: (5.1.1 karmic)
  • Revision ID: james.westby@ubuntu.com-20090711165935-jfwin6gfrxf0gfsi
Tags: 8.4.0-2
* debian/libpq-dev.install: Ship catalog/genbki.h. (Closes: #536139)
* debian/rules: Drop --enable-cassert for final release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 *
27
27
 *
28
28
 * IDENTIFICATION
29
 
 *        $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.324 2009/05/07 22:58:28 tgl Exp $
 
29
 *        $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.326 2009/06/11 20:46:11 tgl Exp $
30
30
 *
31
31
 *-------------------------------------------------------------------------
32
32
 */
62
62
 
63
63
 
64
64
/* Hooks for plugins to get control in ExecutorStart/Run/End() */
65
 
ExecutorStart_hook_type ExecutorStart_hook = NULL;
66
 
ExecutorRun_hook_type   ExecutorRun_hook = NULL;
67
 
ExecutorEnd_hook_type   ExecutorEnd_hook = NULL;
 
65
ExecutorStart_hook_type ExecutorStart_hook = NULL;
 
66
ExecutorRun_hook_type ExecutorRun_hook = NULL;
 
67
ExecutorEnd_hook_type ExecutorEnd_hook = NULL;
68
68
 
69
69
typedef struct evalPlanQual
70
70
{
552
552
                }
553
553
 
554
554
                /*
555
 
                 * Basically the same for the mod columns, with either INSERT or UPDATE
556
 
                 * privilege as specified by remainingPerms.
 
555
                 * Basically the same for the mod columns, with either INSERT or
 
556
                 * UPDATE privilege as specified by remainingPerms.
557
557
                 */
558
558
                remainingPerms &= ~ACL_SELECT;
559
559
                if (remainingPerms != 0)
560
560
                {
561
561
                        /*
562
 
                         * When the query doesn't explicitly change any columns, allow
563
 
                         * the query if we have permission on any column of the rel.  This
564
 
                         * is to handle SELECT FOR UPDATE as well as possible corner cases
565
 
                         * in INSERT and UPDATE.
 
562
                         * When the query doesn't explicitly change any columns, allow the
 
563
                         * query if we have permission on any column of the rel.  This is
 
564
                         * to handle SELECT FOR UPDATE as well as possible corner cases in
 
565
                         * INSERT and UPDATE.
566
566
                         */
567
567
                        if (bms_is_empty(rte->modifiedCols))
568
568
                        {
843
843
 
844
844
        /*
845
845
         * Initialize the junk filter if needed.  SELECT and INSERT queries need a
846
 
         * filter if there are any junk attrs in the tlist.  UPDATE and
847
 
         * DELETE always need a filter, since there's always a junk 'ctid'
848
 
         * attribute present --- no need to look first.
 
846
         * filter if there are any junk attrs in the tlist.  UPDATE and DELETE
 
847
         * always need a filter, since there's always a junk 'ctid' attribute
 
848
         * present --- no need to look first.
849
849
         *
850
850
         * This section of code is also a convenient place to verify that the
851
851
         * output of an INSERT or UPDATE matches the target table(s).
1194
1194
                                                 errdetail("Table has type %s at ordinal position %d, but query expects %s.",
1195
1195
                                                                   format_type_be(attr->atttypid),
1196
1196
                                                                   attno,
1197
 
                                                                   format_type_be(exprType((Node *) tle->expr)))));
 
1197
                                                         format_type_be(exprType((Node *) tle->expr)))));
1198
1198
                }
1199
1199
                else
1200
1200
                {
1215
1215
        if (attno != resultDesc->natts)
1216
1216
                ereport(ERROR,
1217
1217
                                (errcode(ERRCODE_DATATYPE_MISMATCH),
1218
 
                                 errmsg("table row type and query-specified row type do not match"),
 
1218
                  errmsg("table row type and query-specified row type do not match"),
1219
1219
                                 errdetail("Query has too few columns.")));
1220
1220
}
1221
1221
 
1547
1547
                                        /* if child rel, must check whether it produced this row */
1548
1548
                                        if (erm->rti != erm->prti)
1549
1549
                                        {
1550
 
                                                Oid             tableoid;
 
1550
                                                Oid                     tableoid;
1551
1551
 
1552
1552
                                                datum = ExecGetJunkAttribute(slot,
1553
1553
                                                                                                         erm->toidAttNo,
1774
1774
         * rowtype.
1775
1775
         *
1776
1776
         * XXX if we ever wanted to allow users to assign their own OIDs to new
1777
 
         * rows, this'd be the place to do it.  For the moment, we make a point
1778
 
         * of doing this before calling triggers, so that a user-supplied trigger
 
1777
         * rows, this'd be the place to do it.  For the moment, we make a point of
 
1778
         * doing this before calling triggers, so that a user-supplied trigger
1779
1779
         * could hack the OID if desired.
1780
1780
         */
1781
1781
        if (resultRelationDesc->rd_rel->relhasoids)
2847
2847
        Oid                     intoRelationId;
2848
2848
        TupleDesc       tupdesc;
2849
2849
        DR_intorel *myState;
2850
 
        static char        *validnsps[] = HEAP_RELOPT_NAMESPACES;
 
2850
        static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
2851
2851
 
2852
2852
        Assert(into);
2853
2853
 
2953
2953
 
2954
2954
        (void) heap_reloptions(RELKIND_TOASTVALUE, reloptions, true);
2955
2955
 
2956
 
        AlterTableCreateToastTable(intoRelationId, reloptions, false);
 
2956
        AlterTableCreateToastTable(intoRelationId, InvalidOid, reloptions, false);
2957
2957
 
2958
2958
        /*
2959
2959
         * And open the constructed table for writing.
2970
2970
        myState->rel = intoRelationDesc;
2971
2971
 
2972
2972
        /*
2973
 
         * We can skip WAL-logging the insertions, unless PITR is in use.  We
2974
 
         * can skip the FSM in any case.
 
2973
         * We can skip WAL-logging the insertions, unless PITR is in use.  We can
 
2974
         * skip the FSM in any case.
2975
2975
         */
2976
2976
        myState->hi_options = HEAP_INSERT_SKIP_FSM |
2977
2977
                (XLogArchivingActive() ? 0 : HEAP_INSERT_SKIP_WAL);