1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-25 20:23:07 +03:00

8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list

provided by Andrew.
This commit is contained in:
Bruce Momjian
2009-06-11 14:49:15 +00:00
parent 4e86efb4e5
commit d747140279
654 changed files with 11900 additions and 11387 deletions

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.48 2009/01/01 17:23:37 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/aggregatecmds.c,v 1.49 2009/06/11 14:48:55 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -173,18 +173,18 @@ DefineAggregate(List *name, List *args, bool oldstyle, List *parameters)
*
* transtype can't be a pseudo-type, since we need to be able to store
* values of the transtype. However, we can allow polymorphic transtype
* in some cases (AggregateCreate will check). Also, we allow "internal"
* in some cases (AggregateCreate will check). Also, we allow "internal"
* for functions that want to pass pointers to private data structures;
* but allow that only to superusers, since you could crash the system
* (or worse) by connecting up incompatible internal-using functions
* in an aggregate.
* but allow that only to superusers, since you could crash the system (or
* worse) by connecting up incompatible internal-using functions in an
* aggregate.
*/
transTypeId = typenameTypeId(NULL, transType, NULL);
if (get_typtype(transTypeId) == TYPTYPE_PSEUDO &&
!IsPolymorphicType(transTypeId))
{
if (transTypeId == INTERNALOID && superuser())
/* okay */ ;
/* okay */ ;
else
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.138 2009/06/06 22:13:51 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.139 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,8 +177,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
{
if (onerel->rd_rel->relisshared)
ereport(WARNING,
(errmsg("skipping \"%s\" --- only superuser can analyze it",
RelationGetRelationName(onerel))));
(errmsg("skipping \"%s\" --- only superuser can analyze it",
RelationGetRelationName(onerel))));
else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE)
ereport(WARNING,
(errmsg("skipping \"%s\" --- only superuser or database owner can analyze it",
@@ -234,8 +234,8 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
RelationGetRelationName(onerel))));
/*
* Switch to the table owner's userid, so that any index functions are
* run as that user.
* Switch to the table owner's userid, so that any index functions are run
* as that user.
*/
GetUserIdAndContext(&save_userid, &save_secdefcxt);
SetUserIdAndContext(onerel->rd_rel->relowner, true);
@@ -467,7 +467,7 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt,
/*
* Same for indexes. Vacuum always scans all indexes, so if we're part of
* VACUUM ANALYZE, don't overwrite the accurate count already inserted by
* VACUUM ANALYZE, don't overwrite the accurate count already inserted by
* VACUUM.
*/
if (!vacstmt->vacuum)
@@ -719,8 +719,8 @@ examine_attribute(Relation onerel, int attnum)
return NULL;
/*
* Create the VacAttrStats struct. Note that we only have a copy of
* the fixed fields of the pg_attribute tuple.
* Create the VacAttrStats struct. Note that we only have a copy of the
* fixed fields of the pg_attribute tuple.
*/
stats = (VacAttrStats *) palloc0(sizeof(VacAttrStats));
stats->attr = (Form_pg_attribute) palloc(ATTRIBUTE_FIXED_PART_SIZE);
@@ -737,10 +737,9 @@ examine_attribute(Relation onerel, int attnum)
stats->tupattnum = attnum;
/*
* The fields describing the stats->stavalues[n] element types default
* to the type of the field being analyzed, but the type-specific
* typanalyze function can change them if it wants to store something
* else.
* The fields describing the stats->stavalues[n] element types default to
* the type of the field being analyzed, but the type-specific typanalyze
* function can change them if it wants to store something else.
*/
for (i = 0; i < STATISTIC_NUM_SLOTS; i++)
{
@@ -894,7 +893,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
double *totalrows, double *totaldeadrows)
{
int numrows = 0; /* # rows now in reservoir */
double samplerows = 0; /* total # rows collected */
double samplerows = 0; /* total # rows collected */
double liverows = 0; /* # live rows seen */
double deadrows = 0; /* # dead rows seen */
double rowstoskip = -1; /* -1 means not set yet */
@@ -931,9 +930,9 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
* the maxoffset value stays good (else concurrent VACUUM might delete
* tuples out from under us). Hence, pin the page until we are done
* looking at it. We also choose to hold sharelock on the buffer
* throughout --- we could release and re-acquire sharelock for
* each tuple, but since we aren't doing much work per tuple, the
* extra lock traffic is probably better avoided.
* throughout --- we could release and re-acquire sharelock for each
* tuple, but since we aren't doing much work per tuple, the extra
* lock traffic is probably better avoided.
*/
targbuffer = ReadBufferExtended(onerel, MAIN_FORKNUM, targblock,
RBM_NORMAL, vac_strategy);
@@ -952,9 +951,9 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
/*
* We ignore unused and redirect line pointers. DEAD line
* pointers should be counted as dead, because we need vacuum
* to run to get rid of them. Note that this rule agrees with
* the way that heap_page_prune() counts things.
* pointers should be counted as dead, because we need vacuum to
* run to get rid of them. Note that this rule agrees with the
* way that heap_page_prune() counts things.
*/
if (!ItemIdIsNormal(itemid))
{
@@ -984,6 +983,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
break;
case HEAPTUPLE_INSERT_IN_PROGRESS:
/*
* Insert-in-progress rows are not counted. We assume
* that when the inserting transaction commits or aborts,
@@ -991,17 +991,17 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
* count. This works right only if that transaction ends
* after we finish analyzing the table; if things happen
* in the other order, its stats update will be
* overwritten by ours. However, the error will be
* large only if the other transaction runs long enough
* to insert many tuples, so assuming it will finish
* after us is the safer option.
* overwritten by ours. However, the error will be large
* only if the other transaction runs long enough to
* insert many tuples, so assuming it will finish after us
* is the safer option.
*
* A special case is that the inserting transaction might
* be our own. In this case we should count and sample
* be our own. In this case we should count and sample
* the row, to accommodate users who load a table and
* analyze it in one transaction. (pgstat_report_analyze
* has to adjust the numbers we send to the stats collector
* to make this come out right.)
* has to adjust the numbers we send to the stats
* collector to make this come out right.)
*/
if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(targtuple.t_data)))
{
@@ -1011,6 +1011,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
break;
case HEAPTUPLE_DELETE_IN_PROGRESS:
/*
* We count delete-in-progress rows as still live, using
* the same reasoning given above; but we don't bother to
@@ -1019,8 +1020,8 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
* If the delete was done by our own transaction, however,
* we must count the row as dead to make
* pgstat_report_analyze's stats adjustments come out
* right. (Note: this works out properly when the row
* was both inserted and deleted in our xact.)
* right. (Note: this works out properly when the row was
* both inserted and deleted in our xact.)
*/
if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmax(targtuple.t_data)))
deadrows += 1;
@@ -1054,8 +1055,8 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
/*
* t in Vitter's paper is the number of records already
* processed. If we need to compute a new S value, we
* must use the not-yet-incremented value of samplerows
* as t.
* must use the not-yet-incremented value of samplerows as
* t.
*/
if (rowstoskip < 0)
rowstoskip = get_next_S(samplerows, targrows, &rstate);
@@ -1385,10 +1386,10 @@ update_attstats(Oid relid, int natts, VacAttrStats **vacattrstats)
{
/* Yes, replace it */
stup = heap_modify_tuple(oldtup,
RelationGetDescr(sd),
values,
nulls,
replaces);
RelationGetDescr(sd),
values,
nulls,
replaces);
ReleaseSysCache(oldtup);
simple_heap_update(sd, &stup->t_self, stup);
}
@@ -1883,9 +1884,10 @@ compute_minimal_stats(VacAttrStatsP stats,
stats->numnumbers[0] = num_mcv;
stats->stavalues[0] = mcv_values;
stats->numvalues[0] = num_mcv;
/*
* Accept the defaults for stats->statypid and others.
* They have been set before we were called (see vacuum.h)
* Accept the defaults for stats->statypid and others. They have
* been set before we were called (see vacuum.h)
*/
}
}
@@ -2232,9 +2234,10 @@ compute_scalar_stats(VacAttrStatsP stats,
stats->numnumbers[slot_idx] = num_mcv;
stats->stavalues[slot_idx] = mcv_values;
stats->numvalues[slot_idx] = num_mcv;
/*
* Accept the defaults for stats->statypid and others.
* They have been set before we were called (see vacuum.h)
* Accept the defaults for stats->statypid and others. They have
* been set before we were called (see vacuum.h)
*/
slot_idx++;
}
@@ -2312,7 +2315,7 @@ compute_scalar_stats(VacAttrStatsP stats,
/*
* The object of this loop is to copy the first and last values[]
* entries along with evenly-spaced values in between. So the
* entries along with evenly-spaced values in between. So the
* i'th value is values[(i * (nvals - 1)) / (num_hist - 1)]. But
* computing that subscript directly risks integer overflow when
* the stats target is more than a couple thousand. Instead we
@@ -2344,9 +2347,10 @@ compute_scalar_stats(VacAttrStatsP stats,
stats->staop[slot_idx] = mystats->ltopr;
stats->stavalues[slot_idx] = hist_values;
stats->numvalues[slot_idx] = num_hist;
/*
* Accept the defaults for stats->statypid and others.
* They have been set before we were called (see vacuum.h)
* Accept the defaults for stats->statypid and others. They have
* been set before we were called (see vacuum.h)
*/
slot_idx++;
}

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.146 2009/02/13 17:12:04 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.147 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,7 +53,7 @@
* transaction.
*
* Like NOTIFY, LISTEN and UNLISTEN just add the desired action to a list
* of pending actions. If we reach transaction commit, the changes are
* of pending actions. If we reach transaction commit, the changes are
* applied to pg_listener just before executing any pending NOTIFYs. This
* method is necessary because to avoid race conditions, we must hold lock
* on pg_listener from when we insert a new listener tuple until we commit.
@@ -124,12 +124,12 @@ typedef enum
typedef struct
{
ListenActionKind action;
char condname[1]; /* actually, as long as needed */
char condname[1]; /* actually, as long as needed */
} ListenAction;
static List *pendingActions = NIL; /* list of ListenAction */
static List *pendingActions = NIL; /* list of ListenAction */
static List *upperPendingActions = NIL; /* list of upper-xact lists */
static List *upperPendingActions = NIL; /* list of upper-xact lists */
/*
* State for outbound notifies consists of a list of all relnames NOTIFYed
@@ -147,7 +147,7 @@ static List *upperPendingActions = NIL; /* list of upper-xact lists */
* condition name, it will get a self-notify at commit. This is a bit odd
* but is consistent with our historical behavior.
*/
static List *pendingNotifies = NIL; /* list of C strings */
static List *pendingNotifies = NIL; /* list of C strings */
static List *upperPendingNotifies = NIL; /* list of upper-xact lists */
@@ -209,10 +209,9 @@ Async_Notify(const char *relname)
oldcontext = MemoryContextSwitchTo(CurTransactionContext);
/*
* Ordering of the list isn't important. We choose to put new
* entries on the front, as this might make duplicate-elimination
* a tad faster when the same condition is signaled many times in
* a row.
* Ordering of the list isn't important. We choose to put new entries
* on the front, as this might make duplicate-elimination a tad faster
* when the same condition is signaled many times in a row.
*/
pendingNotifies = lcons(pstrdup(relname), pendingNotifies);
@@ -235,10 +234,10 @@ queue_listen(ListenActionKind action, const char *condname)
ListenAction *actrec;
/*
* Unlike Async_Notify, we don't try to collapse out duplicates.
* It would be too complicated to ensure we get the right interactions
* of conflicting LISTEN/UNLISTEN/UNLISTEN_ALL, and it's unlikely that
* there would be any performance benefit anyway in sane applications.
* Unlike Async_Notify, we don't try to collapse out duplicates. It would
* be too complicated to ensure we get the right interactions of
* conflicting LISTEN/UNLISTEN/UNLISTEN_ALL, and it's unlikely that there
* would be any performance benefit anyway in sane applications.
*/
oldcontext = MemoryContextSwitchTo(CurTransactionContext);
@@ -488,7 +487,7 @@ Exec_Listen(Relation lRel, const char *relname)
namestrcpy(&condname, relname);
values[Anum_pg_listener_relname - 1] = NameGetDatum(&condname);
values[Anum_pg_listener_pid - 1] = Int32GetDatum(MyProcPid);
values[Anum_pg_listener_notify - 1] = Int32GetDatum(0); /* no notifies pending */
values[Anum_pg_listener_notify - 1] = Int32GetDatum(0); /* no notifies pending */
tuple = heap_form_tuple(RelationGetDescr(lRel), values, nulls);
@@ -755,9 +754,9 @@ AtSubAbort_Notify(void)
int my_level = GetCurrentTransactionNestLevel();
/*
* All we have to do is pop the stack --- the actions/notifies made in this
* subxact are no longer interesting, and the space will be freed when
* CurTransactionContext is recycled.
* All we have to do is pop the stack --- the actions/notifies made in
* this subxact are no longer interesting, and the space will be freed
* when CurTransactionContext is recycled.
*
* This routine could be called more than once at a given nesting level if
* there is trouble during subxact abort. Avoid dumping core by using

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.184 2009/05/07 22:58:28 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.185 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -631,9 +631,9 @@ rebuild_relation(Relation OldHeap, Oid indexOid)
/*
* At this point, everything is kosher except that the toast table's name
* corresponds to the temporary table. The name is irrelevant to
* the backend because it's referenced by OID, but users looking at the
* catalogs could be confused. Rename it to prevent this problem.
* corresponds to the temporary table. The name is irrelevant to the
* backend because it's referenced by OID, but users looking at the
* catalogs could be confused. Rename it to prevent this problem.
*
* Note no lock required on the relation, because we already hold an
* exclusive lock on it.
@@ -679,10 +679,10 @@ make_new_heap(Oid OIDOldHeap, const char *NewName, Oid NewTableSpace)
/*
* Need to make a copy of the tuple descriptor, since
* heap_create_with_catalog modifies it. Note that the NewHeap will
* not receive any of the defaults or constraints associated with the
* OldHeap; we don't need 'em, and there's no reason to spend cycles
* inserting them into the catalogs only to delete them.
* heap_create_with_catalog modifies it. Note that the NewHeap will not
* receive any of the defaults or constraints associated with the OldHeap;
* we don't need 'em, and there's no reason to spend cycles inserting them
* into the catalogs only to delete them.
*/
tupdesc = CreateTupleDescCopy(OldHeapDesc);
@@ -811,8 +811,8 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
&OldestXmin, &FreezeXid, NULL);
/*
* FreezeXid will become the table's new relfrozenxid, and that mustn't
* go backwards, so take the max.
* FreezeXid will become the table's new relfrozenxid, and that mustn't go
* backwards, so take the max.
*/
if (TransactionIdPrecedes(FreezeXid, OldHeap->rd_rel->relfrozenxid))
FreezeXid = OldHeap->rd_rel->relfrozenxid;

View File

@@ -7,7 +7,7 @@
* Copyright (c) 1996-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.106 2009/01/01 17:23:37 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.107 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -249,7 +249,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
else
{
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(description), values,
nulls, replaces);
nulls, replaces);
simple_heap_update(description, &oldtuple->t_self, newtuple);
}
@@ -263,7 +263,7 @@ CreateComments(Oid oid, Oid classoid, int32 subid, char *comment)
if (newtuple == NULL && comment != NULL)
{
newtuple = heap_form_tuple(RelationGetDescr(description),
values, nulls);
values, nulls);
simple_heap_insert(description, newtuple);
}
@@ -344,7 +344,7 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment)
else
{
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(shdescription),
values, nulls, replaces);
values, nulls, replaces);
simple_heap_update(shdescription, &oldtuple->t_self, newtuple);
}
@@ -358,7 +358,7 @@ CreateSharedComments(Oid oid, Oid classoid, char *comment)
if (newtuple == NULL && comment != NULL)
{
newtuple = heap_form_tuple(RelationGetDescr(shdescription),
values, nulls);
values, nulls);
simple_heap_insert(shdescription, newtuple);
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.38 2009/02/27 16:35:26 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/conversioncmds.c,v 1.39 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -87,8 +87,8 @@ CreateConversionCommand(CreateConversionStmt *stmt)
if (get_func_rettype(funcoid) != VOIDOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("encoding conversion function %s must return type \"void\"",
NameListToString(func_name))));
errmsg("encoding conversion function %s must return type \"void\"",
NameListToString(func_name))));
/* Check we have EXECUTE rights for the function */
aclresult = pg_proc_aclcheck(funcoid, GetUserId(), ACL_EXECUTE);
@@ -97,10 +97,10 @@ CreateConversionCommand(CreateConversionStmt *stmt)
NameListToString(func_name));
/*
* Check that the conversion function is suitable for the requested
* source and target encodings. We do that by calling the function with
* an empty string; the conversion function should throw an error if it
* can't perform the requested conversion.
* Check that the conversion function is suitable for the requested source
* and target encodings. We do that by calling the function with an empty
* string; the conversion function should throw an error if it can't
* perform the requested conversion.
*/
OidFunctionCall5(funcoid,
Int32GetDatum(from_encoding),
@@ -124,19 +124,19 @@ void
DropConversionsCommand(DropStmt *drop)
{
ObjectAddresses *objects;
ListCell *cell;
ListCell *cell;
/*
* First we identify all the conversions, then we delete them in a single
* performMultipleDeletions() call. This is to avoid unwanted
* DROP RESTRICT errors if one of the conversions depends on another.
* (Not that that is very likely, but we may as well do this consistently.)
* performMultipleDeletions() call. This is to avoid unwanted DROP
* RESTRICT errors if one of the conversions depends on another. (Not that
* that is very likely, but we may as well do this consistently.)
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
List *name = (List *) lfirst(cell);
List *name = (List *) lfirst(cell);
Oid conversionOid;
HeapTuple tuple;
Form_pg_conversion con;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.311 2009/06/03 15:06:48 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.312 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -178,7 +178,7 @@ typedef struct
* function call overhead in tight COPY loops.
*
* We must use "if (1)" because the usual "do {...} while(0)" wrapper would
* prevent the continue/break processing from working. We end the "if (1)"
* prevent the continue/break processing from working. We end the "if (1)"
* with "else ((void) 0)" to ensure the "if" does not unintentionally match
* any "else" in the calling code, and to avoid any compiler warnings about
* empty statements. See http://www.cit.gu.edu.au/~anthony/info/C/C.macros.
@@ -859,7 +859,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString)
if (strlen(cstate->delim) != 1)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("COPY delimiter must be a single one-byte character")));
errmsg("COPY delimiter must be a single one-byte character")));
/* Disallow end-of-line characters */
if (strchr(cstate->delim, '\r') != NULL ||
@@ -879,8 +879,8 @@ DoCopy(const CopyStmt *stmt, const char *queryString)
* backslash because it would be ambiguous. We can't allow the other
* cases because data characters matching the delimiter must be
* backslashed, and certain backslash combinations are interpreted
* non-literally by COPY IN. Disallowing all lower case ASCII letters
* is more than strictly necessary, but seems best for consistency and
* non-literally by COPY IN. Disallowing all lower case ASCII letters is
* more than strictly necessary, but seems best for consistency and
* future-proofing. Likewise we disallow all digits though only octal
* digits are actually dangerous.
*/
@@ -1670,7 +1670,7 @@ CopyFrom(CopyState cstate)
MemoryContext oldcontext = CurrentMemoryContext;
ErrorContextCallback errcontext;
CommandId mycid = GetCurrentCommandId(true);
int hi_options = 0; /* start with default heap_insert options */
int hi_options = 0; /* start with default heap_insert options */
BulkInsertState bistate;
Assert(cstate->rel);
@@ -2454,10 +2454,10 @@ CopyReadLineText(CopyState cstate)
ereport(ERROR,
(errcode(ERRCODE_BAD_COPY_FILE_FORMAT),
!cstate->csv_mode ?
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/*
@@ -2474,7 +2474,7 @@ CopyReadLineText(CopyState cstate)
errmsg("literal carriage return found in data") :
errmsg("unquoted carriage return found in data"),
!cstate->csv_mode ?
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use \"\\r\" to represent carriage return.") :
errhint("Use quoted CSV field to represent carriage return.")));
/* If reach here, we have found the line terminator */
break;
@@ -2491,7 +2491,7 @@ CopyReadLineText(CopyState cstate)
errmsg("unquoted newline found in data"),
!cstate->csv_mode ?
errhint("Use \"\\n\" to represent newline.") :
errhint("Use quoted CSV field to represent newline.")));
errhint("Use quoted CSV field to represent newline.")));
cstate->eol_type = EOL_NL; /* in case not set yet */
/* If reach here, we have found the line terminator */
break;
@@ -2847,9 +2847,9 @@ CopyReadAttributesText(CopyState cstate, int maxfields, char **fieldvals)
*output_ptr++ = '\0';
/*
* If we de-escaped a non-7-bit-ASCII char, make sure we still
* have valid data for the db encoding. Avoid calling strlen here for
* the sake of efficiency.
* If we de-escaped a non-7-bit-ASCII char, make sure we still have
* valid data for the db encoding. Avoid calling strlen here for the
* sake of efficiency.
*/
if (saw_non_ascii)
{
@@ -2945,12 +2945,12 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals)
start_ptr = cur_ptr;
fieldvals[fieldno] = output_ptr;
/* Scan data for field,
/*
* Scan data for field,
*
* The loop starts in "not quote" mode and then toggles between
* that and "in quote" mode.
* The loop exits normally if it is in "not quote" mode and a
* delimiter or line end is seen.
* The loop starts in "not quote" mode and then toggles between that
* and "in quote" mode. The loop exits normally if it is in "not
* quote" mode and a delimiter or line end is seen.
*/
for (;;)
{
@@ -2994,8 +2994,8 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals)
if (c == escapec)
{
/*
* peek at the next char if available, and escape it if it is
* an escape char or a quote char
* peek at the next char if available, and escape it if it
* is an escape char or a quote char
*/
if (cur_ptr < line_end_ptr)
{
@@ -3009,10 +3009,11 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals)
}
}
}
/*
* end of quoted field. Must do this test after testing for escape
* in case quote char and escape char are the same (which is the
* common case).
* end of quoted field. Must do this test after testing for
* escape in case quote char and escape char are the same
* (which is the common case).
*/
if (c == quotec)
break;
@@ -3021,7 +3022,7 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals)
*output_ptr++ = c;
}
}
endfield:
endfield:
/* Terminate attribute value in output area */
*output_ptr++ = '\0';
@@ -3144,11 +3145,11 @@ CopyAttributeOutText(CopyState cstate, char *string)
if ((unsigned char) c < (unsigned char) 0x20)
{
/*
* \r and \n must be escaped, the others are traditional.
* We prefer to dump these using the C-like notation, rather
* than a backslash and the literal character, because it
* makes the dump file a bit more proof against Microsoftish
* data mangling.
* \r and \n must be escaped, the others are traditional. We
* prefer to dump these using the C-like notation, rather than
* a backslash and the literal character, because it makes the
* dump file a bit more proof against Microsoftish data
* mangling.
*/
switch (c)
{
@@ -3182,7 +3183,7 @@ CopyAttributeOutText(CopyState cstate, char *string)
DUMPSOFAR();
CopySendChar(cstate, '\\');
CopySendChar(cstate, c);
start = ++ptr; /* do not include char in next run */
start = ++ptr; /* do not include char in next run */
}
else if (c == '\\' || c == delimc)
{
@@ -3204,11 +3205,11 @@ CopyAttributeOutText(CopyState cstate, char *string)
if ((unsigned char) c < (unsigned char) 0x20)
{
/*
* \r and \n must be escaped, the others are traditional.
* We prefer to dump these using the C-like notation, rather
* than a backslash and the literal character, because it
* makes the dump file a bit more proof against Microsoftish
* data mangling.
* \r and \n must be escaped, the others are traditional. We
* prefer to dump these using the C-like notation, rather than
* a backslash and the literal character, because it makes the
* dump file a bit more proof against Microsoftish data
* mangling.
*/
switch (c)
{
@@ -3242,7 +3243,7 @@ CopyAttributeOutText(CopyState cstate, char *string)
DUMPSOFAR();
CopySendChar(cstate, '\\');
CopySendChar(cstate, c);
start = ++ptr; /* do not include char in next run */
start = ++ptr; /* do not include char in next run */
}
else if (c == '\\' || c == delimc)
{

View File

@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.224 2009/05/06 16:15:21 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.225 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -334,8 +334,8 @@ createdb(const CreatedbStmt *stmt)
/*
* Check whether chosen encoding matches chosen locale settings. This
* restriction is necessary because libc's locale-specific code usually
* fails when presented with data in an encoding it's not expecting.
* We allow mismatch in three cases:
* fails when presented with data in an encoding it's not expecting. We
* allow mismatch in three cases:
*
* 1. locale encoding = SQL_ASCII, which means either that the locale is
* C/POSIX which works with any encoding, or that we couldn't determine
@@ -365,8 +365,8 @@ createdb(const CreatedbStmt *stmt)
errmsg("encoding %s does not match locale %s",
pg_encoding_to_char(encoding),
dbctype),
errdetail("The chosen LC_CTYPE setting requires encoding %s.",
pg_encoding_to_char(ctype_encoding))));
errdetail("The chosen LC_CTYPE setting requires encoding %s.",
pg_encoding_to_char(ctype_encoding))));
if (!(collate_encoding == encoding ||
collate_encoding == PG_SQL_ASCII ||
@@ -554,7 +554,7 @@ createdb(const CreatedbStmt *stmt)
new_record_nulls[Anum_pg_database_datacl - 1] = true;
tuple = heap_form_tuple(RelationGetDescr(pg_database_rel),
new_record, new_record_nulls);
new_record, new_record_nulls);
HeapTupleSetOid(tuple, dboid);
@@ -716,9 +716,9 @@ createdb_failure_callback(int code, Datum arg)
createdb_failure_params *fparms = (createdb_failure_params *) DatumGetPointer(arg);
/*
* Release lock on source database before doing recursive remove.
* This is not essential but it seems desirable to release the lock
* as soon as possible.
* Release lock on source database before doing recursive remove. This is
* not essential but it seems desirable to release the lock as soon as
* possible.
*/
UnlockSharedObject(DatabaseRelationId, fparms->src_dboid, 0, ShareLock);
@@ -842,9 +842,9 @@ dropdb(const char *dbname, bool missing_ok)
/*
* Tell bgwriter to forget any pending fsync and unlink requests for files
* in the database; else the fsyncs will fail at next checkpoint, or worse,
* it will delete files that belong to a newly created database with the
* same OID.
* in the database; else the fsyncs will fail at next checkpoint, or
* worse, it will delete files that belong to a newly created database
* with the same OID.
*/
ForgetDatabaseFsyncRequests(db_id);
@@ -975,21 +975,23 @@ RenameDatabase(const char *oldname, const char *newname)
static void
movedb(const char *dbname, const char *tblspcname)
{
Oid db_id;
Relation pgdbrel;
int notherbackends;
int npreparedxacts;
HeapTuple oldtuple, newtuple;
Oid src_tblspcoid, dst_tblspcoid;
Datum new_record[Natts_pg_database];
bool new_record_nulls[Natts_pg_database];
bool new_record_repl[Natts_pg_database];
ScanKeyData scankey;
SysScanDesc sysscan;
AclResult aclresult;
char *src_dbpath;
char *dst_dbpath;
DIR *dstdir;
Oid db_id;
Relation pgdbrel;
int notherbackends;
int npreparedxacts;
HeapTuple oldtuple,
newtuple;
Oid src_tblspcoid,
dst_tblspcoid;
Datum new_record[Natts_pg_database];
bool new_record_nulls[Natts_pg_database];
bool new_record_repl[Natts_pg_database];
ScanKeyData scankey;
SysScanDesc sysscan;
AclResult aclresult;
char *src_dbpath;
char *dst_dbpath;
DIR *dstdir;
struct dirent *xlde;
movedb_failure_params fparms;
@@ -1089,13 +1091,13 @@ movedb(const char *dbname, const char *tblspcname)
/*
* Force a checkpoint before proceeding. This will force dirty buffers out
* to disk, to ensure source database is up-to-date on disk for the
* copy. FlushDatabaseBuffers() would suffice for that, but we also want
* to process any pending unlink requests. Otherwise, the check for
* existing files in the target directory might fail unnecessarily, not to
* mention that the copy might fail due to source files getting deleted
* under it. On Windows, this also ensures that the bgwriter doesn't hold
* any open files, which would cause rmdir() to fail.
* to disk, to ensure source database is up-to-date on disk for the copy.
* FlushDatabaseBuffers() would suffice for that, but we also want to
* process any pending unlink requests. Otherwise, the check for existing
* files in the target directory might fail unnecessarily, not to mention
* that the copy might fail due to source files getting deleted under it.
* On Windows, this also ensures that the bgwriter doesn't hold any open
* files, which would cause rmdir() to fail.
*/
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
@@ -1125,8 +1127,8 @@ movedb(const char *dbname, const char *tblspcname)
FreeDir(dstdir);
/*
* The directory exists but is empty.
* We must remove it before using the copydir function.
* The directory exists but is empty. We must remove it before using
* the copydir function.
*/
if (rmdir(dst_dbpath) != 0)
elog(ERROR, "could not remove directory \"%s\": %m",
@@ -1135,7 +1137,7 @@ movedb(const char *dbname, const char *tblspcname)
/*
* Use an ENSURE block to make sure we remove the debris if the copy fails
* (eg, due to out-of-disk-space). This is not a 100% solution, because
* (eg, due to out-of-disk-space). This is not a 100% solution, because
* of the possibility of failure during transaction commit, but it should
* handle most scenarios.
*/
@@ -1179,7 +1181,7 @@ movedb(const char *dbname, const char *tblspcname)
sysscan = systable_beginscan(pgdbrel, DatabaseNameIndexId, true,
SnapshotNow, 1, &scankey);
oldtuple = systable_getnext(sysscan);
if (!HeapTupleIsValid(oldtuple)) /* shouldn't happen... */
if (!HeapTupleIsValid(oldtuple)) /* shouldn't happen... */
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_DATABASE),
errmsg("database \"%s\" does not exist", dbname)));
@@ -1228,13 +1230,13 @@ movedb(const char *dbname, const char *tblspcname)
PointerGetDatum(&fparms));
/*
* Commit the transaction so that the pg_database update is committed.
* If we crash while removing files, the database won't be corrupt,
* we'll just leave some orphaned files in the old directory.
* Commit the transaction so that the pg_database update is committed. If
* we crash while removing files, the database won't be corrupt, we'll
* just leave some orphaned files in the old directory.
*
* (This is OK because we know we aren't inside a transaction block.)
*
* XXX would it be safe/better to do this inside the ensure block? Not
* XXX would it be safe/better to do this inside the ensure block? Not
* convinced it's a good idea; consider elog just after the transaction
* really commits.
*/
@@ -1389,7 +1391,7 @@ AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel)
}
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel), new_record,
new_record_nulls, new_record_repl);
new_record_nulls, new_record_repl);
simple_heap_update(rel, &tuple->t_self, newtuple);
/* Update indexes */
@@ -1482,7 +1484,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt)
}
newtuple = heap_modify_tuple(tuple, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &tuple->t_self, newtuple);
/* Update indexes */
@@ -1720,11 +1722,11 @@ get_db_info(const char *name, LOCKMODE lockmode,
/* default tablespace for this database */
if (dbTablespace)
*dbTablespace = dbform->dattablespace;
/* default locale settings for this database */
if (dbCollate)
*dbCollate = pstrdup(NameStr(dbform->datcollate));
if (dbCtype)
*dbCtype = pstrdup(NameStr(dbform->datctype));
/* default locale settings for this database */
if (dbCollate)
*dbCollate = pstrdup(NameStr(dbform->datcollate));
if (dbCtype)
*dbCtype = pstrdup(NameStr(dbform->datctype));
ReleaseSysCache(tuple);
result = true;
break;

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.185 2009/04/05 19:59:39 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.186 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -61,7 +61,7 @@ static void explain_outNode(StringInfo str,
Plan *outer_plan,
int indent, ExplainState *es);
static void show_plan_tlist(Plan *plan,
StringInfo str, int indent, ExplainState *es);
StringInfo str, int indent, ExplainState *es);
static void show_scan_qual(List *qual, const char *qlabel,
int scanrelid, Plan *scan_plan, Plan *outer_plan,
StringInfo str, int indent, ExplainState *es);
@@ -342,7 +342,7 @@ void
ExplainPrintPlan(StringInfo str, QueryDesc *queryDesc,
bool analyze, bool verbose)
{
ExplainState es;
ExplainState es;
Assert(queryDesc->plannedstmt != NULL);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/foreigncmds.c,v 1.7 2009/04/04 21:12:31 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/foreigncmds.c,v 1.8 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,8 +47,8 @@
static Datum
optionListToArray(List *options)
{
ArrayBuildState *astate = NULL;
ListCell *cell;
ArrayBuildState *astate = NULL;
ListCell *cell;
foreach(cell, options)
{
@@ -76,7 +76,7 @@ optionListToArray(List *options)
/*
* Transform a list of DefElem into text array format. This is substantially
* Transform a list of DefElem into text array format. This is substantially
* the same thing as optionListToArray(), except we recognize SET/ADD/DROP
* actions for modifying an existing list of options, which is passed in
* Datum form as oldOptions. Also, if fdwvalidator isn't InvalidOid
@@ -92,23 +92,23 @@ transformGenericOptions(Datum oldOptions,
List *options,
Oid fdwvalidator)
{
List *resultOptions = untransformRelOptions(oldOptions);
ListCell *optcell;
Datum result;
List *resultOptions = untransformRelOptions(oldOptions);
ListCell *optcell;
Datum result;
foreach(optcell, options)
{
DefElem *od = lfirst(optcell);
DefElem *od = lfirst(optcell);
ListCell *cell;
ListCell *prev = NULL;
/*
* Find the element in resultOptions. We need this for
* validation in all cases. Also identify the previous element.
* Find the element in resultOptions. We need this for validation in
* all cases. Also identify the previous element.
*/
foreach (cell, resultOptions)
foreach(cell, resultOptions)
{
DefElem *def = lfirst(cell);
DefElem *def = lfirst(cell);
if (strcmp(def->defname, od->defname) == 0)
break;
@@ -117,10 +117,10 @@ transformGenericOptions(Datum oldOptions,
}
/*
* It is possible to perform multiple SET/DROP actions on the
* same option. The standard permits this, as long as the
* options to be added are unique. Note that an unspecified
* action is taken to be ADD.
* It is possible to perform multiple SET/DROP actions on the same
* option. The standard permits this, as long as the options to be
* added are unique. Note that an unspecified action is taken to be
* ADD.
*/
switch (od->defaction)
{
@@ -174,16 +174,16 @@ transformGenericOptions(Datum oldOptions,
static Oid
GetUserOidFromMapping(const char *username, bool missing_ok)
{
if (!username)
/* PUBLIC user mapping */
return InvalidOid;
if (!username)
/* PUBLIC user mapping */
return InvalidOid;
if (strcmp(username, "current_user") == 0)
/* map to the owner */
return GetUserId();
if (strcmp(username, "current_user") == 0)
/* map to the owner */
return GetUserId();
/* map to provided user */
return missing_ok ? get_roleid(username) : get_roleid_checked(username);
/* map to provided user */
return missing_ok ? get_roleid(username) : get_roleid_checked(username);
}
@@ -201,7 +201,7 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
Oid fdwId;
Form_pg_foreign_data_wrapper form;
/* Must be a superuser to change a FDW owner */
/* Must be a superuser to change a FDW owner */
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
@@ -209,13 +209,13 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
name),
errhint("Must be superuser to change owner of a foreign-data wrapper.")));
/* New owner must also be a superuser */
/* New owner must also be a superuser */
if (!superuser_arg(newOwnerId))
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to change owner of foreign-data wrapper \"%s\"",
name),
errhint("The owner of a foreign-data wrapper must be a superuser.")));
errhint("The owner of a foreign-data wrapper must be a superuser.")));
rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
@@ -226,7 +226,7 @@ AlterForeignDataWrapperOwner(const char *name, Oid newOwnerId)
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("foreign-data wrapper \"%s\" does not exist", name)));
errmsg("foreign-data wrapper \"%s\" does not exist", name)));
fdwId = HeapTupleGetOid(tup);
form = (Form_pg_foreign_data_wrapper) GETSTRUCT(tup);
@@ -268,9 +268,9 @@ AlterForeignServerOwner(const char *name, Oid newOwnerId)
0, 0, 0);
if (!HeapTupleIsValid(tup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("server \"%s\" does not exist", name)));
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("server \"%s\" does not exist", name)));
srvId = HeapTupleGetOid(tup);
form = (Form_pg_foreign_server) GETSTRUCT(tup);
@@ -334,22 +334,22 @@ lookup_fdw_validator_func(List *validator)
void
CreateForeignDataWrapper(CreateFdwStmt *stmt)
{
Relation rel;
Datum values[Natts_pg_foreign_data_wrapper];
bool nulls[Natts_pg_foreign_data_wrapper];
HeapTuple tuple;
Oid fdwId;
Oid fdwvalidator;
Datum fdwoptions;
Oid ownerId;
Relation rel;
Datum values[Natts_pg_foreign_data_wrapper];
bool nulls[Natts_pg_foreign_data_wrapper];
HeapTuple tuple;
Oid fdwId;
Oid fdwvalidator;
Datum fdwoptions;
Oid ownerId;
/* Must be super user */
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to create foreign-data wrapper \"%s\"",
stmt->fdwname),
errhint("Must be superuser to create a foreign-data wrapper.")));
errmsg("permission denied to create foreign-data wrapper \"%s\"",
stmt->fdwname),
errhint("Must be superuser to create a foreign-data wrapper.")));
/* For now the owner cannot be specified on create. Use effective user ID. */
ownerId = GetUserId();
@@ -440,9 +440,9 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to alter foreign-data wrapper \"%s\"",
stmt->fdwname),
errhint("Must be superuser to alter a foreign-data wrapper.")));
errmsg("permission denied to alter foreign-data wrapper \"%s\"",
stmt->fdwname),
errhint("Must be superuser to alter a foreign-data wrapper.")));
tp = SearchSysCacheCopy(FOREIGNDATAWRAPPERNAME,
CStringGetDatum(stmt->fdwname),
@@ -451,7 +451,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
if (!HeapTupleIsValid(tp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("foreign-data wrapper \"%s\" does not exist", stmt->fdwname)));
errmsg("foreign-data wrapper \"%s\" does not exist", stmt->fdwname)));
fdwId = HeapTupleGetOid(tp);
@@ -467,18 +467,17 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
/*
* It could be that the options for the FDW, SERVER and USER MAPPING
* are no longer valid with the new validator. Warn about this.
* are no longer valid with the new validator. Warn about this.
*/
if (stmt->validator)
ereport(WARNING,
(errmsg("changing the foreign-data wrapper validator can cause "
"the options for dependent objects to become invalid")));
(errmsg("changing the foreign-data wrapper validator can cause "
"the options for dependent objects to become invalid")));
}
else
{
/*
* Validator is not changed, but we need it for validating
* options.
* Validator is not changed, but we need it for validating options.
*/
datum = SysCacheGetAttr(FOREIGNDATAWRAPPEROID,
tp,
@@ -517,7 +516,7 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
rel = heap_open(ForeignDataWrapperRelationId, RowExclusiveLock);
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &tp->t_self, tp);
CatalogUpdateIndexes(rel, tp);
@@ -533,30 +532,30 @@ AlterForeignDataWrapper(AlterFdwStmt *stmt)
void
RemoveForeignDataWrapper(DropFdwStmt *stmt)
{
Oid fdwId;
ObjectAddress object;
Oid fdwId;
ObjectAddress object;
fdwId = GetForeignDataWrapperOidByName(stmt->fdwname, true);
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("permission denied to drop foreign-data wrapper \"%s\"",
stmt->fdwname),
errhint("Must be superuser to drop a foreign-data wrapper.")));
errmsg("permission denied to drop foreign-data wrapper \"%s\"",
stmt->fdwname),
errhint("Must be superuser to drop a foreign-data wrapper.")));
if (!OidIsValid(fdwId))
{
if (!stmt->missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("foreign-data wrapper \"%s\" does not exist",
stmt->fdwname)));
errmsg("foreign-data wrapper \"%s\" does not exist",
stmt->fdwname)));
/* IF EXISTS specified, just note it */
ereport(NOTICE,
(errmsg("foreign-data wrapper \"%s\" does not exist, skipping",
stmt->fdwname)));
(errmsg("foreign-data wrapper \"%s\" does not exist, skipping",
stmt->fdwname)));
return;
}
@@ -603,16 +602,16 @@ RemoveForeignDataWrapperById(Oid fdwId)
void
CreateForeignServer(CreateForeignServerStmt *stmt)
{
Relation rel;
Datum srvoptions;
Datum values[Natts_pg_foreign_server];
bool nulls[Natts_pg_foreign_server];
HeapTuple tuple;
Oid srvId;
Oid ownerId;
AclResult aclresult;
ObjectAddress myself;
ObjectAddress referenced;
Relation rel;
Datum srvoptions;
Datum values[Natts_pg_foreign_server];
bool nulls[Natts_pg_foreign_server];
HeapTuple tuple;
Oid srvId;
Oid ownerId;
AclResult aclresult;
ObjectAddress myself;
ObjectAddress referenced;
ForeignDataWrapper *fdw;
/* For now the owner cannot be specified on create. Use effective user ID. */
@@ -628,8 +627,8 @@ CreateForeignServer(CreateForeignServerStmt *stmt)
stmt->servername)));
/*
* Check that the FDW exists and that we have USAGE on it.
* Also get the actual FDW for option validation etc.
* Check that the FDW exists and that we have USAGE on it. Also get the
* actual FDW for option validation etc.
*/
fdw = GetForeignDataWrapperByName(stmt->fdwname, false);
@@ -712,7 +711,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
bool repl_null[Natts_pg_foreign_server];
bool repl_repl[Natts_pg_foreign_server];
Oid srvId;
Form_pg_foreign_server srvForm;
Form_pg_foreign_server srvForm;
tp = SearchSysCacheCopy(FOREIGNSERVERNAME,
CStringGetDatum(stmt->servername),
@@ -721,7 +720,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
if (!HeapTupleIsValid(tp))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("server \"%s\" does not exist", stmt->servername)));
errmsg("server \"%s\" does not exist", stmt->servername)));
srvId = HeapTupleGetOid(tp);
srvForm = (Form_pg_foreign_server) GETSTRUCT(tp);
@@ -754,8 +753,8 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
if (stmt->options)
{
ForeignDataWrapper *fdw = GetForeignDataWrapper(srvForm->srvfdw);
Datum datum;
bool isnull;
Datum datum;
bool isnull;
/* Extract the current srvoptions */
datum = SysCacheGetAttr(FOREIGNSERVEROID,
@@ -782,7 +781,7 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
rel = heap_open(ForeignServerRelationId, RowExclusiveLock);
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &tp->t_self, tp);
CatalogUpdateIndexes(rel, tp);
@@ -798,8 +797,8 @@ AlterForeignServer(AlterForeignServerStmt *stmt)
void
RemoveForeignServer(DropForeignServerStmt *stmt)
{
Oid srvId;
ObjectAddress object;
Oid srvId;
ObjectAddress object;
srvId = GetForeignServerOidByName(stmt->servername, true);
@@ -809,7 +808,7 @@ RemoveForeignServer(DropForeignServerStmt *stmt)
if (!stmt->missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("server \"%s\" does not exist", stmt->servername)));
errmsg("server \"%s\" does not exist", stmt->servername)));
/* IF EXISTS specified, just note it */
ereport(NOTICE,
@@ -871,7 +870,7 @@ user_mapping_ddl_aclcheck(Oid umuserid, Oid serverid, const char *servername)
{
if (umuserid == curuserid)
{
AclResult aclresult;
AclResult aclresult;
aclresult = pg_foreign_server_aclcheck(serverid, curuserid, ACL_USAGE);
if (aclresult != ACLCHECK_OK)
@@ -890,16 +889,16 @@ user_mapping_ddl_aclcheck(Oid umuserid, Oid serverid, const char *servername)
void
CreateUserMapping(CreateUserMappingStmt *stmt)
{
Relation rel;
Datum useoptions;
Datum values[Natts_pg_user_mapping];
bool nulls[Natts_pg_user_mapping];
HeapTuple tuple;
Oid useId;
Oid umId;
ObjectAddress myself;
ObjectAddress referenced;
ForeignServer *srv;
Relation rel;
Datum useoptions;
Datum values[Natts_pg_user_mapping];
bool nulls[Natts_pg_user_mapping];
HeapTuple tuple;
Oid useId;
Oid umId;
ObjectAddress myself;
ObjectAddress referenced;
ForeignServer *srv;
ForeignDataWrapper *fdw;
useId = GetUserOidFromMapping(stmt->username, false);
@@ -913,9 +912,9 @@ CreateUserMapping(CreateUserMappingStmt *stmt)
* Check that the user mapping is unique within server.
*/
umId = GetSysCacheOid(USERMAPPINGUSERSERVER,
ObjectIdGetDatum(useId),
ObjectIdGetDatum(srv->serverid),
0, 0);
ObjectIdGetDatum(useId),
ObjectIdGetDatum(srv->serverid),
0, 0);
if (OidIsValid(umId))
ereport(ERROR,
(errcode(ERRCODE_DUPLICATE_OBJECT),
@@ -984,7 +983,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
bool repl_repl[Natts_pg_user_mapping];
Oid useId;
Oid umId;
ForeignServer *srv;
ForeignServer *srv;
useId = GetUserOidFromMapping(stmt->username, false);
srv = GetForeignServerByName(stmt->servername, false);
@@ -996,8 +995,8 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
if (!OidIsValid(umId))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("user mapping \"%s\" does not exist for the server",
MappingUserName(useId))));
errmsg("user mapping \"%s\" does not exist for the server",
MappingUserName(useId))));
user_mapping_ddl_aclcheck(useId, srv->serverid, stmt->servername);
@@ -1014,9 +1013,9 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
if (stmt->options)
{
ForeignDataWrapper *fdw;
Datum datum;
bool isnull;
ForeignDataWrapper *fdw;
Datum datum;
bool isnull;
/*
* Process the options.
@@ -1048,7 +1047,7 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
rel = heap_open(UserMappingRelationId, RowExclusiveLock);
tp = heap_modify_tuple(tp, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &tp->t_self, tp);
CatalogUpdateIndexes(rel, tp);
@@ -1064,10 +1063,10 @@ AlterUserMapping(AlterUserMappingStmt *stmt)
void
RemoveUserMapping(DropUserMappingStmt *stmt)
{
ObjectAddress object;
Oid useId;
Oid umId;
ForeignServer *srv;
ObjectAddress object;
Oid useId;
Oid umId;
ForeignServer *srv;
useId = GetUserOidFromMapping(stmt->username, stmt->missing_ok);
srv = GetForeignServerByName(stmt->servername, true);
@@ -1075,8 +1074,8 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
if (stmt->username && !OidIsValid(useId))
{
/*
* IF EXISTS specified, role not found and not public.
* Notice this and leave.
* IF EXISTS specified, role not found and not public. Notice this and
* leave.
*/
elog(NOTICE, "role \"%s\" does not exist, skipping", stmt->username);
return;
@@ -1087,8 +1086,8 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
if (!stmt->missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("server \"%s\" does not exist",
stmt->servername)));
errmsg("server \"%s\" does not exist",
stmt->servername)));
/* IF EXISTS, just note it */
ereport(NOTICE, (errmsg("server does not exist, skipping")));
return;
@@ -1104,13 +1103,13 @@ RemoveUserMapping(DropUserMappingStmt *stmt)
if (!stmt->missing_ok)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("user mapping \"%s\" does not exist for the server",
MappingUserName(useId))));
errmsg("user mapping \"%s\" does not exist for the server",
MappingUserName(useId))));
/* IF EXISTS specified, just note it */
ereport(NOTICE,
(errmsg("user mapping \"%s\" does not exist for the server, skipping",
MappingUserName(useId))));
(errmsg("user mapping \"%s\" does not exist for the server, skipping",
MappingUserName(useId))));
return;
}

View File

@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.109 2009/03/04 11:53:53 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.110 2009/06/11 14:48:55 momjian Exp $
*
* DESCRIPTION
* These routines take the parse tree and pick out the
@@ -274,7 +274,7 @@ examine_parameter_list(List *parameters, Oid languageOid,
if (!OidIsValid(get_element_type(toid)))
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("VARIADIC parameter must be an array")));
errmsg("VARIADIC parameter must be an array")));
break;
}
}
@@ -291,12 +291,12 @@ examine_parameter_list(List *parameters, Oid languageOid,
if (fp->defexpr)
{
Node *def;
Node *def;
if (!isinput)
ereport(ERROR,
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
errmsg("only input parameters can have default values")));
errmsg("only input parameters can have default values")));
def = transformExpr(pstate, fp->defexpr);
def = coerce_to_specific_type(pstate, def, toid, "DEFAULT");
@@ -324,7 +324,7 @@ examine_parameter_list(List *parameters, Oid languageOid,
if (pstate->p_hasSubLinks)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot use subquery in parameter default value")));
errmsg("cannot use subquery in parameter default value")));
if (pstate->p_hasAggs)
ereport(ERROR,
(errcode(ERRCODE_GROUPING_ERROR),
@@ -685,7 +685,7 @@ interpret_AS_clause(Oid languageOid, const char *languageName,
{
/*
* For "C" language, store the file name in probin and, when given,
* the link symbol name in prosrc. If link symbol is omitted,
* the link symbol name in prosrc. If link symbol is omitted,
* substitute procedure name. We also allow link symbol to be
* specified as "-", since that was the habit in PG versions before
* 8.4, and there might be dump files out there that don't translate
@@ -1243,7 +1243,7 @@ AlterFunctionOwner_internal(Relation rel, HeapTuple tup, Oid newOwnerId)
}
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel), repl_val,
repl_null, repl_repl);
repl_null, repl_repl);
simple_heap_update(rel, &newtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);
@@ -1375,7 +1375,7 @@ AlterFunction(AlterFunctionStmt *stmt)
}
tup = heap_modify_tuple(tup, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
repl_val, repl_null, repl_repl);
}
/* Do the update */
@@ -1513,7 +1513,7 @@ CreateCast(CreateCastStmt *stmt)
/* Detemine the cast method */
if (stmt->func != NULL)
castmethod = COERCION_METHOD_FUNCTION;
else if(stmt->inout)
else if (stmt->inout)
castmethod = COERCION_METHOD_INOUT;
else
castmethod = COERCION_METHOD_BINARY;
@@ -1541,7 +1541,7 @@ CreateCast(CreateCastStmt *stmt)
if (!IsBinaryCoercible(sourcetypeid, procstruct->proargtypes.values[0]))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("argument of cast function must match or be binary-coercible from source data type")));
errmsg("argument of cast function must match or be binary-coercible from source data type")));
if (nargs > 1 && procstruct->proargtypes.values[1] != INT4OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
@@ -1573,7 +1573,7 @@ CreateCast(CreateCastStmt *stmt)
if (procstruct->proiswindow)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("cast function must not be a window function")));
errmsg("cast function must not be a window function")));
if (procstruct->proretset)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
@@ -1622,7 +1622,7 @@ CreateCast(CreateCastStmt *stmt)
/*
* We know that composite, enum and array types are never binary-
* compatible with each other. They all have OIDs embedded in them.
* compatible with each other. They all have OIDs embedded in them.
*
* Theoretically you could build a user-defined base type that is
* binary-compatible with a composite, enum, or array type. But we
@@ -1633,7 +1633,7 @@ CreateCast(CreateCastStmt *stmt)
targettyptype == TYPTYPE_COMPOSITE)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("composite data types are not binary-compatible")));
errmsg("composite data types are not binary-compatible")));
if (sourcetyptype == TYPTYPE_ENUM ||
targettyptype == TYPTYPE_ENUM)

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.184 2009/04/04 17:40:36 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/indexcmds.c,v 1.185 2009/06/11 14:48:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -639,25 +639,25 @@ DefineIndex(RangeVar *heapRelation,
* We can exclude any running transactions that have xmin > the xmin of
* our reference snapshot; their oldest snapshot must be newer than ours.
* We can also exclude any transactions that have xmin = zero, since they
* evidently have no live snapshot at all (and any one they might be
* in process of taking is certainly newer than ours). Transactions in
* other DBs can be ignored too, since they'll never even be able to see
* this index.
* evidently have no live snapshot at all (and any one they might be in
* process of taking is certainly newer than ours). Transactions in other
* DBs can be ignored too, since they'll never even be able to see this
* index.
*
* We can also exclude autovacuum processes and processes running manual
* lazy VACUUMs, because they won't be fazed by missing index entries
* either. (Manual ANALYZEs, however, can't be excluded because they
* either. (Manual ANALYZEs, however, can't be excluded because they
* might be within transactions that are going to do arbitrary operations
* later.)
*
* Also, GetCurrentVirtualXIDs never reports our own vxid, so we need not
* check for that.
*
* If a process goes idle-in-transaction with xmin zero, we do not need
* to wait for it anymore, per the above argument. We do not have the
* infrastructure right now to stop waiting if that happens, but we can
* at least avoid the folly of waiting when it is idle at the time we
* would begin to wait. We do this by repeatedly rechecking the output of
* If a process goes idle-in-transaction with xmin zero, we do not need to
* wait for it anymore, per the above argument. We do not have the
* infrastructure right now to stop waiting if that happens, but we can at
* least avoid the folly of waiting when it is idle at the time we would
* begin to wait. We do this by repeatedly rechecking the output of
* GetCurrentVirtualXIDs. If, during any iteration, a particular vxid
* doesn't show up in the output, we know we can forget about it.
*/
@@ -680,12 +680,12 @@ DefineIndex(RangeVar *heapRelation,
newer_snapshots = GetCurrentVirtualXIDs(snapshot->xmin,
true, false,
PROC_IS_AUTOVACUUM | PROC_IN_VACUUM,
PROC_IS_AUTOVACUUM | PROC_IN_VACUUM,
&n_newer_snapshots);
for (j = i; j < n_old_snapshots; j++)
{
if (!VirtualTransactionIdIsValid(old_snapshots[j]))
continue; /* found uninteresting in previous cycle */
continue; /* found uninteresting in previous cycle */
for (k = 0; k < n_newer_snapshots; k++)
{
if (VirtualTransactionIdEquals(old_snapshots[j],
@@ -1058,7 +1058,7 @@ GetDefaultOpClass(Oid type_id, Oid am_id)
ScanKeyData skey[1];
SysScanDesc scan;
HeapTuple tup;
TYPCATEGORY tcategory;
TYPCATEGORY tcategory;
/* If it's a domain, look at the base type instead */
type_id = getBaseType(type_id);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/lockcmds.c,v 1.24 2009/05/12 16:43:32 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/lockcmds.c,v 1.25 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,7 +25,7 @@
#include "utils/lsyscache.h"
static void LockTableRecurse(Oid reloid, RangeVar *rv,
LOCKMODE lockmode, bool nowait, bool recurse);
LOCKMODE lockmode, bool nowait, bool recurse);
/*
@@ -67,9 +67,9 @@ LockTableRecurse(Oid reloid, RangeVar *rv,
AclResult aclresult;
/*
* Acquire the lock. We must do this first to protect against
* concurrent drops. Note that a lock against an already-dropped
* relation's OID won't fail.
* Acquire the lock. We must do this first to protect against concurrent
* drops. Note that a lock against an already-dropped relation's OID
* won't fail.
*/
if (nowait)
{
@@ -148,8 +148,8 @@ LockTableRecurse(Oid reloid, RangeVar *rv,
*/
if (recurse)
{
List *children = find_inheritance_children(reloid, NoLock);
ListCell *lc;
List *children = find_inheritance_children(reloid, NoLock);
ListCell *lc;
foreach(lc, children)
{

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.42 2009/01/01 17:23:39 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/operatorcmds.c,v 1.43 2009/06/11 14:48:56 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -188,9 +188,9 @@ DefineOperator(List *names, List *parameters)
functionOid = LookupFuncName(functionName, nargs, typeId, false);
/*
* We require EXECUTE rights for the function. This isn't strictly
* necessary, since EXECUTE will be checked at any attempted use of
* the operator, but it seems like a good idea anyway.
* We require EXECUTE rights for the function. This isn't strictly
* necessary, since EXECUTE will be checked at any attempted use of the
* operator, but it seems like a good idea anyway.
*/
aclresult = pg_proc_aclcheck(functionOid, GetUserId(), ACL_EXECUTE);
if (aclresult != ACLCHECK_OK)
@@ -237,9 +237,9 @@ DefineOperator(List *names, List *parameters)
typeId[4] = INTERNALOID; /* SpecialJoinInfo */
/*
* As of Postgres 8.4, the preferred signature for join estimators
* has 5 arguments, but we still allow the old 4-argument form.
* Try the preferred form first.
* As of Postgres 8.4, the preferred signature for join estimators has
* 5 arguments, but we still allow the old 4-argument form. Try the
* preferred form first.
*/
joinOid = LookupFuncName(joinName, 5, typeId, true);
if (!OidIsValid(joinOid))
@@ -252,8 +252,8 @@ DefineOperator(List *names, List *parameters)
if (get_func_rettype(joinOid) != FLOAT8OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("join estimator function %s must return type \"float8\"",
NameListToString(joinName))));
errmsg("join estimator function %s must return type \"float8\"",
NameListToString(joinName))));
/* Require EXECUTE rights for the estimator */
aclresult = pg_proc_aclcheck(joinOid, GetUserId(), ACL_EXECUTE);
@@ -271,7 +271,7 @@ DefineOperator(List *names, List *parameters)
oprNamespace, /* namespace */
typeId1, /* left type id */
typeId2, /* right type id */
functionOid, /* function for operator */
functionOid, /* function for operator */
commutatorName, /* optional commutator operator name */
negatorName, /* optional negator operator name */
restrictionOid, /* optional restrict. sel. procedure */

View File

@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.78 2009/01/01 17:23:39 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.79 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -352,8 +352,8 @@ PersistHoldablePortal(Portal portal)
ExecutorRewind(queryDesc);
/*
* Change the destination to output to the tuplestore. Note we
* tell the tuplestore receiver to detoast all data passed through it.
* Change the destination to output to the tuplestore. Note we tell
* the tuplestore receiver to detoast all data passed through it.
*/
queryDesc->dest = CreateDestReceiver(DestTuplestore);
SetTuplestoreDestReceiverParams(queryDesc->dest,

View File

@@ -10,7 +10,7 @@
* Copyright (c) 2002-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.96 2009/01/02 20:42:00 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.97 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -350,7 +350,7 @@ EvaluateParams(PreparedStatement *pstmt, List *params,
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("cannot use window function in EXECUTE parameter")));
errmsg("cannot use window function in EXECUTE parameter")));
given_type_id = exprType(expr);

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.84 2009/01/01 17:23:39 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/proclang.c,v 1.85 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -140,7 +140,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
pltemplate->tmplhandler,
pltemplate->tmpllibrary,
false, /* isAgg */
false, /* isWindowFunc */
false, /* isWindowFunc */
false, /* security_definer */
false, /* isStrict */
PROVOLATILE_VOLATILE,
@@ -175,7 +175,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
pltemplate->tmplvalidator,
pltemplate->tmpllibrary,
false, /* isAgg */
false, /* isWindowFunc */
false, /* isWindowFunc */
false, /* security_definer */
false, /* isStrict */
PROVOLATILE_VOLATILE,
@@ -635,7 +635,7 @@ AlterLanguageOwner_internal(HeapTuple tup, Relation rel, Oid newOwnerId)
}
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &newtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.52 2009/01/01 17:23:39 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/schemacmds.c,v 1.53 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -87,8 +87,8 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString)
* temporarily set the current user so that the object(s) will be created
* with the correct ownership.
*
* (The setting will be restored at the end of this routine, or in case
* of error, transaction abort will clean things up.)
* (The setting will be restored at the end of this routine, or in case of
* error, transaction abort will clean things up.)
*/
if (saved_uid != owner_uid)
SetUserIdAndContext(owner_uid, true);
@@ -155,12 +155,12 @@ void
RemoveSchemas(DropStmt *drop)
{
ObjectAddresses *objects;
ListCell *cell;
ListCell *cell;
/*
* First we identify all the schemas, then we delete them in a single
* performMultipleDeletions() call. This is to avoid unwanted
* DROP RESTRICT errors if one of the schemas depends on another.
* performMultipleDeletions() call. This is to avoid unwanted DROP
* RESTRICT errors if one of the schemas depends on another.
*/
objects = new_object_addresses();

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.159 2009/04/04 21:12:31 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.160 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1199,8 +1199,8 @@ init_params(List *options, bool isInit,
snprintf(bufm, sizeof(bufm), INT64_FORMAT, new->min_value);
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("RESTART value (%s) cannot be less than MINVALUE (%s)",
bufs, bufm)));
errmsg("RESTART value (%s) cannot be less than MINVALUE (%s)",
bufs, bufm)));
}
if (new->last_value > new->max_value)
{
@@ -1211,8 +1211,8 @@ init_params(List *options, bool isInit,
snprintf(bufm, sizeof(bufm), INT64_FORMAT, new->max_value);
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("RESTART value (%s) cannot be greater than MAXVALUE (%s)",
bufs, bufm)));
errmsg("RESTART value (%s) cannot be greater than MAXVALUE (%s)",
bufs, bufm)));
}
/* CACHE */

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.285 2009/05/20 08:48:10 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.286 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -137,7 +137,7 @@ typedef struct AlteredTableInfo
List *constraints; /* List of NewConstraint */
List *newvals; /* List of NewColumnValue */
bool new_notnull; /* T if we added new NOT NULL constraints */
bool new_changeoids; /* T if we added/dropped the OID column */
bool new_changeoids; /* T if we added/dropped the OID column */
Oid newTableSpace; /* new tablespace; 0 means no change */
/* Objects to rebuild after completing ALTER TYPE operations */
List *changedConstraintOids; /* OIDs of constraints to rebuild */
@@ -187,35 +187,35 @@ struct dropmsgstrings
static const struct dropmsgstrings dropmsgstringarray[] = {
{RELKIND_RELATION,
ERRCODE_UNDEFINED_TABLE,
gettext_noop("table \"%s\" does not exist"),
gettext_noop("table \"%s\" does not exist, skipping"),
gettext_noop("\"%s\" is not a table"),
gettext_noop("Use DROP TABLE to remove a table.")},
ERRCODE_UNDEFINED_TABLE,
gettext_noop("table \"%s\" does not exist"),
gettext_noop("table \"%s\" does not exist, skipping"),
gettext_noop("\"%s\" is not a table"),
gettext_noop("Use DROP TABLE to remove a table.")},
{RELKIND_SEQUENCE,
ERRCODE_UNDEFINED_TABLE,
gettext_noop("sequence \"%s\" does not exist"),
gettext_noop("sequence \"%s\" does not exist, skipping"),
gettext_noop("\"%s\" is not a sequence"),
gettext_noop("Use DROP SEQUENCE to remove a sequence.")},
ERRCODE_UNDEFINED_TABLE,
gettext_noop("sequence \"%s\" does not exist"),
gettext_noop("sequence \"%s\" does not exist, skipping"),
gettext_noop("\"%s\" is not a sequence"),
gettext_noop("Use DROP SEQUENCE to remove a sequence.")},
{RELKIND_VIEW,
ERRCODE_UNDEFINED_TABLE,
gettext_noop("view \"%s\" does not exist"),
gettext_noop("view \"%s\" does not exist, skipping"),
gettext_noop("\"%s\" is not a view"),
gettext_noop("Use DROP VIEW to remove a view.")},
ERRCODE_UNDEFINED_TABLE,
gettext_noop("view \"%s\" does not exist"),
gettext_noop("view \"%s\" does not exist, skipping"),
gettext_noop("\"%s\" is not a view"),
gettext_noop("Use DROP VIEW to remove a view.")},
{RELKIND_INDEX,
ERRCODE_UNDEFINED_OBJECT,
gettext_noop("index \"%s\" does not exist"),
gettext_noop("index \"%s\" does not exist, skipping"),
gettext_noop("\"%s\" is not an index"),
gettext_noop("Use DROP INDEX to remove an index.")},
ERRCODE_UNDEFINED_OBJECT,
gettext_noop("index \"%s\" does not exist"),
gettext_noop("index \"%s\" does not exist, skipping"),
gettext_noop("\"%s\" is not an index"),
gettext_noop("Use DROP INDEX to remove an index.")},
{RELKIND_COMPOSITE_TYPE,
ERRCODE_UNDEFINED_OBJECT,
gettext_noop("type \"%s\" does not exist"),
gettext_noop("type \"%s\" does not exist, skipping"),
gettext_noop("\"%s\" is not a type"),
gettext_noop("Use DROP TYPE to remove a type.")},
ERRCODE_UNDEFINED_OBJECT,
gettext_noop("type \"%s\" does not exist"),
gettext_noop("type \"%s\" does not exist, skipping"),
gettext_noop("\"%s\" is not a type"),
gettext_noop("Use DROP TYPE to remove a type.")},
{'\0', 0, NULL, NULL, NULL, NULL}
};
@@ -256,7 +256,7 @@ static void ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
bool recurse, bool recursing);
static void ATRewriteCatalogs(List **wqueue);
static void ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
AlterTableCmd *cmd);
AlterTableCmd *cmd);
static void ATRewriteTables(List **wqueue);
static void ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap);
static AlteredTableInfo *ATGetQueueEntry(List **wqueue, Relation rel);
@@ -272,7 +272,7 @@ static void ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
ColumnDef *colDef, bool isOid);
static void add_column_datatype_dependency(Oid relid, int32 attnum, Oid typid);
static void ATPrepAddOids(List **wqueue, Relation rel, bool recurse,
AlterTableCmd *cmd);
AlterTableCmd *cmd);
static void ATExecDropNotNull(Relation rel, const char *colName);
static void ATExecSetNotNull(AlteredTableInfo *tab, Relation rel,
const char *colName);
@@ -290,17 +290,17 @@ static void ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
static void ATExecAddIndex(AlteredTableInfo *tab, Relation rel,
IndexStmt *stmt, bool is_rebuild);
static void ATExecAddConstraint(List **wqueue,
AlteredTableInfo *tab, Relation rel,
Node *newConstraint, bool recurse);
AlteredTableInfo *tab, Relation rel,
Node *newConstraint, bool recurse);
static void ATAddCheckConstraint(List **wqueue,
AlteredTableInfo *tab, Relation rel,
Constraint *constr,
bool recurse, bool recursing);
AlteredTableInfo *tab, Relation rel,
Constraint *constr,
bool recurse, bool recursing);
static void ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
FkConstraint *fkconstraint);
static void ATExecDropConstraint(Relation rel, const char *constrName,
DropBehavior behavior,
bool recurse, bool recursing);
DropBehavior behavior,
bool recurse, bool recursing);
static void ATPrepAlterColumnType(List **wqueue,
AlteredTableInfo *tab, Relation rel,
bool recurse, bool recursing,
@@ -324,7 +324,7 @@ static void ATExecEnableDisableRule(Relation rel, char *rulename,
static void ATExecAddInherit(Relation rel, RangeVar *parent);
static void ATExecDropInherit(Relation rel, RangeVar *parent);
static void copy_relation_data(SMgrRelation rel, SMgrRelation dst,
ForkNumber forkNum, bool istemp);
ForkNumber forkNum, bool istemp);
/* ----------------------------------------------------------------
@@ -353,7 +353,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
Datum reloptions;
ListCell *listptr;
AttrNumber attnum;
static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
/*
* Truncate relname to appropriate length (probably a waste of time, as
@@ -435,7 +435,7 @@ DefineRelation(CreateStmt *stmt, char relkind)
&inheritOids, &old_constraints, &parentOidCount);
/*
* Create a tuple descriptor from the relation schema. Note that this
* Create a tuple descriptor from the relation schema. Note that this
* deals with column names, types, and NOT NULL constraints, but not
* default values or CHECK constraints; we handle those below.
*/
@@ -448,9 +448,9 @@ DefineRelation(CreateStmt *stmt, char relkind)
* Find columns with default values and prepare for insertion of the
* defaults. Pre-cooked (that is, inherited) defaults go into a list of
* CookedConstraint structs that we'll pass to heap_create_with_catalog,
* while raw defaults go into a list of RawColumnDefault structs that
* will be processed by AddRelationNewConstraints. (We can't deal with
* raw expressions until we can do transformExpr.)
* while raw defaults go into a list of RawColumnDefault structs that will
* be processed by AddRelationNewConstraints. (We can't deal with raw
* expressions until we can do transformExpr.)
*
* We can set the atthasdef flags now in the tuple descriptor; this just
* saves StoreAttrDefault from having to do an immediate update of the
@@ -495,9 +495,9 @@ DefineRelation(CreateStmt *stmt, char relkind)
}
/*
* Create the relation. Inherited defaults and constraints are passed
* in for immediate handling --- since they don't need parsing, they
* can be stored immediately.
* Create the relation. Inherited defaults and constraints are passed in
* for immediate handling --- since they don't need parsing, they can be
* stored immediately.
*/
relationId = heap_create_with_catalog(relname,
namespaceId,
@@ -606,7 +606,7 @@ DropErrorMsgWrongType(const char *relname, char wrongkind, char rightkind)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg(rentry->nota_msg, relname),
(wentry->kind != '\0') ? errhint("%s", _(wentry->drophint_msg)) : 0));
(wentry->kind != '\0') ? errhint("%s", _(wentry->drophint_msg)) : 0));
}
/*
@@ -622,8 +622,8 @@ RemoveRelations(DropStmt *drop)
/*
* First we identify all the relations, then we delete them in a single
* performMultipleDeletions() call. This is to avoid unwanted
* DROP RESTRICT errors if one of the relations depends on another.
* performMultipleDeletions() call. This is to avoid unwanted DROP
* RESTRICT errors if one of the relations depends on another.
*/
/* Determine required relkind */
@@ -648,7 +648,7 @@ RemoveRelations(DropStmt *drop)
default:
elog(ERROR, "unrecognized drop object type: %d",
(int) drop->removeType);
relkind = 0; /* keep compiler quiet */
relkind = 0; /* keep compiler quiet */
break;
}
@@ -862,11 +862,11 @@ ExecuteTruncate(TruncateStmt *stmt)
#endif
/*
* If we are asked to restart sequences, find all the sequences,
* lock them (we only need AccessShareLock because that's all that
* ALTER SEQUENCE takes), and check permissions. We want to do this
* early since it's pointless to do all the truncation work only to fail
* on sequence permissions.
* If we are asked to restart sequences, find all the sequences, lock them
* (we only need AccessShareLock because that's all that ALTER SEQUENCE
* takes), and check permissions. We want to do this early since it's
* pointless to do all the truncation work only to fail on sequence
* permissions.
*/
if (stmt->restart_seqs)
{
@@ -878,8 +878,8 @@ ExecuteTruncate(TruncateStmt *stmt)
foreach(seqcell, seqlist)
{
Oid seq_relid = lfirst_oid(seqcell);
Relation seq_rel;
Oid seq_relid = lfirst_oid(seqcell);
Relation seq_rel;
seq_rel = relation_open(seq_relid, AccessShareLock);
@@ -899,8 +899,8 @@ ExecuteTruncate(TruncateStmt *stmt)
AfterTriggerBeginQuery();
/*
* To fire triggers, we'll need an EState as well as a ResultRelInfo
* for each relation.
* To fire triggers, we'll need an EState as well as a ResultRelInfo for
* each relation.
*/
estate = CreateExecutorState();
resultRelInfos = (ResultRelInfo *)
@@ -912,7 +912,7 @@ ExecuteTruncate(TruncateStmt *stmt)
InitResultRelInfo(resultRelInfo,
rel,
0, /* dummy rangetable index */
0, /* dummy rangetable index */
CMD_DELETE, /* don't need any index info */
false);
resultRelInfo++;
@@ -922,9 +922,9 @@ ExecuteTruncate(TruncateStmt *stmt)
/*
* Process all BEFORE STATEMENT TRUNCATE triggers before we begin
* truncating (this is because one of them might throw an error).
* Also, if we were to allow them to prevent statement execution,
* that would need to be handled here.
* truncating (this is because one of them might throw an error). Also, if
* we were to allow them to prevent statement execution, that would need
* to be handled here.
*/
resultRelInfo = resultRelInfos;
foreach(cell, rels)
@@ -996,18 +996,18 @@ ExecuteTruncate(TruncateStmt *stmt)
/*
* Lastly, restart any owned sequences if we were asked to. This is done
* last because it's nontransactional: restarts will not roll back if
* we abort later. Hence it's important to postpone them as long as
* last because it's nontransactional: restarts will not roll back if we
* abort later. Hence it's important to postpone them as long as
* possible. (This is also a big reason why we locked and
* permission-checked the sequences beforehand.)
*/
if (stmt->restart_seqs)
{
List *options = list_make1(makeDefElem("restart", NULL));
List *options = list_make1(makeDefElem("restart", NULL));
foreach(cell, seq_relids)
{
Oid seq_relid = lfirst_oid(cell);
Oid seq_relid = lfirst_oid(cell);
AlterSequenceInternal(seq_relid, options);
}
@@ -1361,7 +1361,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
/*
* Now copy the CHECK constraints of this parent, adjusting attnos
* using the completed newattno[] map. Identically named constraints
* using the completed newattno[] map. Identically named constraints
* are merged if possible, else we throw error.
*/
if (constr && constr->num_check > 0)
@@ -1387,7 +1387,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
cooked = (CookedConstraint *) palloc(sizeof(CookedConstraint));
cooked->contype = CONSTR_CHECK;
cooked->name = pstrdup(name);
cooked->attnum = 0; /* not used for constraints */
cooked->attnum = 0; /* not used for constraints */
cooked->expr = expr;
cooked->is_local = false;
cooked->inhcount = 1;
@@ -2052,8 +2052,8 @@ RenameRelation(Oid myrelid, const char *newrelname, ObjectType reltype)
RelationGetRelationName(targetrelation))));
/*
* Don't allow ALTER TABLE on composite types.
* We want people to use ALTER TYPE for that.
* Don't allow ALTER TABLE on composite types. We want people to use ALTER
* TYPE for that.
*/
if (relkind == RELKIND_COMPOSITE_TYPE)
ereport(ERROR,
@@ -2089,8 +2089,8 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId)
Form_pg_class relform;
/*
* Grab an exclusive lock on the target table, index, sequence or
* view, which we will NOT release until end of transaction.
* Grab an exclusive lock on the target table, index, sequence or view,
* which we will NOT release until end of transaction.
*/
targetrelation = relation_open(myrelid, AccessExclusiveLock);
@@ -2166,7 +2166,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId)
* We also reject these commands if there are any pending AFTER trigger events
* for the rel. This is certainly necessary for the rewriting variants of
* ALTER TABLE, because they don't preserve tuple TIDs and so the pending
* events would try to fetch the wrong tuples. It might be overly cautious
* events would try to fetch the wrong tuples. It might be overly cautious
* in other cases, but again it seems better to err on the side of paranoia.
*
* REINDEX calls this with "rel" referencing the index to be rebuilt; here
@@ -2184,7 +2184,7 @@ CheckTableNotInUse(Relation rel, const char *stmt)
if (rel->rd_refcnt != expected_refcnt)
ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE),
/* translator: first %s is a SQL command, eg ALTER TABLE */
/* translator: first %s is a SQL command, eg ALTER TABLE */
errmsg("cannot %s \"%s\" because "
"it is being used by active queries in this session",
stmt, RelationGetRelationName(rel))));
@@ -2193,7 +2193,7 @@ CheckTableNotInUse(Relation rel, const char *stmt)
AfterTriggerPendingOnRel(RelationGetRelid(rel)))
ereport(ERROR,
(errcode(ERRCODE_OBJECT_IN_USE),
/* translator: first %s is a SQL command, eg ALTER TABLE */
/* translator: first %s is a SQL command, eg ALTER TABLE */
errmsg("cannot %s \"%s\" because "
"it has pending trigger events",
stmt, RelationGetRelationName(rel))));
@@ -2220,7 +2220,7 @@ CheckTableNotInUse(Relation rel, const char *stmt)
* expressions that need to be evaluated with respect to the old table
* schema.
*
* ATRewriteCatalogs performs phase 2 for each affected table. (Note that
* ATRewriteCatalogs performs phase 2 for each affected table. (Note that
* phases 2 and 3 normally do no explicit recursion, since phase 1 already
* did it --- although some subcommands have to recurse in phase 2 instead.)
* Certain subcommands need to be performed before others to avoid
@@ -2244,9 +2244,10 @@ AlterTable(AlterTableStmt *stmt)
switch (stmt->relkind)
{
case OBJECT_TABLE:
/*
* For mostly-historical reasons, we allow ALTER TABLE to apply
* to all relation types.
* For mostly-historical reasons, we allow ALTER TABLE to apply to
* all relation types.
*/
break;
@@ -2363,7 +2364,8 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
ATPrepAddColumn(wqueue, rel, recurse, cmd);
pass = AT_PASS_ADD_COL;
break;
case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
case AT_AddColumnToView: /* add column via CREATE OR REPLACE
* VIEW */
ATSimplePermissions(rel, true);
/* Performs own recursion */
ATPrepAddColumn(wqueue, rel, recurse, cmd);
@@ -2597,7 +2599,8 @@ ATExecCmd(List **wqueue, AlteredTableInfo *tab, Relation rel,
switch (cmd->subtype)
{
case AT_AddColumn: /* ADD COLUMN */
case AT_AddColumnToView: /* add column via CREATE OR REPLACE VIEW */
case AT_AddColumnToView: /* add column via CREATE OR REPLACE
* VIEW */
ATExecAddColumn(tab, rel, (ColumnDef *) cmd->def, false);
break;
case AT_ColumnDefault: /* ALTER COLUMN DEFAULT */
@@ -3539,8 +3542,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
if (isOid && childatt->attnum != ObjectIdAttributeNumber)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("child table \"%s\" has a conflicting \"%s\" column",
RelationGetRelationName(rel), colDef->colname)));
errmsg("child table \"%s\" has a conflicting \"%s\" column",
RelationGetRelationName(rel), colDef->colname)));
/* Bump the existing child att's inhcount */
childatt->attinhcount++;
@@ -3690,10 +3693,10 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
* returned by AddRelationNewConstraints, so that the right thing happens
* when a datatype's default applies.
*
* We skip this step completely for views. For a view, we can only get
* We skip this step completely for views. For a view, we can only get
* here from CREATE OR REPLACE VIEW, which historically doesn't set up
* defaults, not even for domain-typed columns. And in any case we mustn't
* invoke Phase 3 on a view, since it has no storage.
* defaults, not even for domain-typed columns. And in any case we
* mustn't invoke Phase 3 on a view, since it has no storage.
*/
if (relkind != RELKIND_VIEW && attribute.attnum > 0)
{
@@ -3715,7 +3718,7 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
COERCION_ASSIGNMENT,
COERCE_IMPLICIT_CAST,
-1);
if (defval == NULL) /* should not happen */
if (defval == NULL) /* should not happen */
elog(ERROR, "failed to coerce base type to domain");
}
@@ -3740,8 +3743,8 @@ ATExecAddColumn(AlteredTableInfo *tab, Relation rel,
}
/*
* If we are adding an OID column, we have to tell Phase 3 to rewrite
* the table to fix that.
* If we are adding an OID column, we have to tell Phase 3 to rewrite the
* table to fix that.
*/
if (isOid)
tab->new_changeoids = true;
@@ -3773,7 +3776,7 @@ add_column_datatype_dependency(Oid relid, int32 attnum, Oid typid)
/*
* ALTER TABLE SET WITH OIDS
*
* Basically this is an ADD COLUMN for the special OID column. We have
* Basically this is an ADD COLUMN for the special OID column. We have
* to cons up a ColumnDef node because the ADD COLUMN code needs one.
*/
static void
@@ -4295,8 +4298,8 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
performDeletion(&object, behavior);
/*
* If we dropped the OID column, must adjust pg_class.relhasoids and
* tell Phase 3 to physically get rid of the column.
* If we dropped the OID column, must adjust pg_class.relhasoids and tell
* Phase 3 to physically get rid of the column.
*/
if (attnum == ObjectIdAttributeNumber)
{
@@ -4410,8 +4413,8 @@ ATExecAddConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
FkConstraint *fkconstraint = (FkConstraint *) newConstraint;
/*
* Note that we currently never recurse for FK constraints,
* so the "recurse" flag is silently ignored.
* Note that we currently never recurse for FK constraints, so
* the "recurse" flag is silently ignored.
*
* Assign or validate constraint name
*/
@@ -4473,8 +4476,8 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
/*
* Call AddRelationNewConstraints to do the work, making sure it works on
* a copy of the Constraint so transformExpr can't modify the original.
* It returns a list of cooked constraints.
* a copy of the Constraint so transformExpr can't modify the original. It
* returns a list of cooked constraints.
*
* If the constraint ends up getting merged with a pre-existing one, it's
* omitted from the returned list, which is what we want: we do not need
@@ -4584,7 +4587,8 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
pkrel = heap_openrv(fkconstraint->pktable, AccessExclusiveLock);
/*
* Validity checks (permission checks wait till we have the column numbers)
* Validity checks (permission checks wait till we have the column
* numbers)
*/
if (pkrel->rd_rel->relkind != RELKIND_RELATION)
ereport(ERROR,
@@ -4810,8 +4814,8 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
NULL, /* no check constraint */
NULL,
NULL,
true, /* islocal */
0); /* inhcount */
true, /* islocal */
0); /* inhcount */
/*
* Create the triggers that will enforce the constraint.
@@ -5400,9 +5404,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
/* Don't drop inherited constraints */
if (con->coninhcount > 0 && !recursing)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("cannot drop inherited constraint \"%s\" of relation \"%s\"",
constrName, RelationGetRelationName(rel))));
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("cannot drop inherited constraint \"%s\" of relation \"%s\"",
constrName, RelationGetRelationName(rel))));
/* Right now only CHECK constraints can be inherited */
if (con->contype == CONSTRAINT_CHECK)
@@ -5459,7 +5463,7 @@ ATExecDropConstraint(Relation rel, const char *constrName,
while (HeapTupleIsValid(tuple = systable_getnext(scan)))
{
HeapTuple copy_tuple;
HeapTuple copy_tuple;
con = (Form_pg_constraint) GETSTRUCT(tuple);
@@ -5472,7 +5476,7 @@ ATExecDropConstraint(Relation rel, const char *constrName,
found = true;
if (con->coninhcount <= 0) /* shouldn't happen */
if (con->coninhcount <= 0) /* shouldn't happen */
elog(ERROR, "relation %u has non-inherited constraint \"%s\"",
childrelid, constrName);
@@ -5482,9 +5486,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
if (recurse)
{
/*
* If the child constraint has other definition sources,
* just decrement its inheritance count; if not, recurse
* to delete it.
* If the child constraint has other definition sources, just
* decrement its inheritance count; if not, recurse to delete
* it.
*/
if (con->coninhcount == 1 && !con->conislocal)
{
@@ -5506,9 +5510,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
else
{
/*
* If we were told to drop ONLY in this table (no
* recursion), we need to mark the inheritors' constraints
* as locally defined rather than inherited.
* If we were told to drop ONLY in this table (no recursion),
* we need to mark the inheritors' constraints as locally
* defined rather than inherited.
*/
con->coninhcount--;
con->conislocal = true;
@@ -5528,9 +5532,9 @@ ATExecDropConstraint(Relation rel, const char *constrName,
if (!found)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("constraint \"%s\" of relation \"%s\" does not exist",
constrName,
RelationGetRelationName(childrel))));
errmsg("constraint \"%s\" of relation \"%s\" does not exist",
constrName,
RelationGetRelationName(childrel))));
heap_close(childrel, NoLock);
}
@@ -5628,7 +5632,7 @@ ATPrepAlterColumnType(List **wqueue,
if (pstate->p_hasWindowFuncs)
ereport(ERROR,
(errcode(ERRCODE_WINDOWING_ERROR),
errmsg("cannot use window function in transform expression")));
errmsg("cannot use window function in transform expression")));
}
else
{
@@ -5745,8 +5749,8 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
if (defaultexpr == NULL)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("default for column \"%s\" cannot be cast to type %s",
colName, format_type_be(targettype))));
errmsg("default for column \"%s\" cannot be cast to type %s",
colName, format_type_be(targettype))));
}
else
defaultexpr = NULL;
@@ -6536,7 +6540,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
Datum repl_val[Natts_pg_class];
bool repl_null[Natts_pg_class];
bool repl_repl[Natts_pg_class];
static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
static char *validnsps[] = HEAP_RELOPT_NAMESPACES;
if (defList == NIL)
return; /* nothing to do */
@@ -6555,7 +6559,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
/* Generate new proposed reloptions (text array) */
newOptions = transformRelOptions(isnull ? (Datum) 0 : datum,
defList, NULL, validnsps, false, isReset);
defList, NULL, validnsps, false, isReset);
/* Validate */
switch (rel->rd_rel->relkind)
@@ -6591,7 +6595,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
repl_repl[Anum_pg_class_reloptions - 1] = true;
newtuple = heap_modify_tuple(tuple, RelationGetDescr(pgclass),
repl_val, repl_null, repl_repl);
repl_val, repl_null, repl_repl);
simple_heap_update(pgclass, &newtuple->t_self, newtuple);
@@ -6619,7 +6623,7 @@ ATExecSetRelOptions(Relation rel, List *defList, bool isReset)
datum = SysCacheGetAttr(RELOID, tuple, Anum_pg_class_reloptions, &isnull);
newOptions = transformRelOptions(isnull ? (Datum) 0 : datum,
defList, "toast", validnsps, false, isReset);
defList, "toast", validnsps, false, isReset);
(void) heap_reloptions(RELKIND_TOASTVALUE, newOptions, true);
@@ -6749,11 +6753,11 @@ ATExecSetTableSpace(Oid tableOid, Oid newTableSpace)
RelationOpenSmgr(rel);
/*
* Create and copy all forks of the relation, and schedule unlinking
* of old physical files.
* Create and copy all forks of the relation, and schedule unlinking of
* old physical files.
*
* NOTE: any conflict in relfilenode value will be caught in
* RelationCreateStorage().
* RelationCreateStorage().
*/
RelationCreateStorage(newrnode, rel->rd_istemp);
@@ -7163,11 +7167,11 @@ MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel)
while (HeapTupleIsValid(parent_tuple = systable_getnext(parent_scan)))
{
Form_pg_constraint parent_con = (Form_pg_constraint) GETSTRUCT(parent_tuple);
SysScanDesc child_scan;
ScanKeyData child_key;
HeapTuple child_tuple;
bool found = false;
Form_pg_constraint parent_con = (Form_pg_constraint) GETSTRUCT(parent_tuple);
SysScanDesc child_scan;
ScanKeyData child_key;
HeapTuple child_tuple;
bool found = false;
if (parent_con->contype != CONSTRAINT_CHECK)
continue;
@@ -7182,8 +7186,8 @@ MergeConstraintsIntoExisting(Relation child_rel, Relation parent_rel)
while (HeapTupleIsValid(child_tuple = systable_getnext(child_scan)))
{
Form_pg_constraint child_con = (Form_pg_constraint) GETSTRUCT(child_tuple);
HeapTuple child_copy;
Form_pg_constraint child_con = (Form_pg_constraint) GETSTRUCT(child_tuple);
HeapTuple child_copy;
if (child_con->contype != CONSTRAINT_CHECK)
continue;
@@ -7344,8 +7348,8 @@ ATExecDropInherit(Relation rel, RangeVar *parent)
heap_close(catalogRelation, RowExclusiveLock);
/*
* Likewise, find inherited check constraints and disinherit them.
* To do this, we first need a list of the names of the parent's check
* Likewise, find inherited check constraints and disinherit them. To do
* this, we first need a list of the names of the parent's check
* constraints. (We cheat a bit by only checking for name matches,
* assuming that the expressions will match.)
*/
@@ -7380,14 +7384,14 @@ ATExecDropInherit(Relation rel, RangeVar *parent)
while (HeapTupleIsValid(constraintTuple = systable_getnext(scan)))
{
Form_pg_constraint con = (Form_pg_constraint) GETSTRUCT(constraintTuple);
bool match;
ListCell *lc;
bool match;
ListCell *lc;
if (con->contype != CONSTRAINT_CHECK)
continue;
match = false;
foreach (lc, connames)
foreach(lc, connames)
{
if (strcmp(NameStr(con->conname), (char *) lfirst(lc)) == 0)
{
@@ -7401,6 +7405,7 @@ ATExecDropInherit(Relation rel, RangeVar *parent)
/* Decrement inhcount and possibly set islocal to true */
HeapTuple copyTuple = heap_copytuple(constraintTuple);
Form_pg_constraint copy_con = (Form_pg_constraint) GETSTRUCT(copyTuple);
if (copy_con->coninhcount <= 0) /* shouldn't happen */
elog(ERROR, "relation %u has non-inherited constraint \"%s\"",
RelationGetRelid(rel), NameStr(copy_con->conname));
@@ -7484,9 +7489,10 @@ AlterTableNamespace(RangeVar *relation, const char *newschema,
switch (stmttype)
{
case OBJECT_TABLE:
/*
* For mostly-historical reasons, we allow ALTER TABLE to apply
* to all relation types.
* For mostly-historical reasons, we allow ALTER TABLE to apply to
* all relation types.
*/
break;

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.246 2009/01/22 20:16:02 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.247 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -274,8 +274,8 @@ CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid, bool checkPermissions)
}
/*
* Scan pg_trigger for existing triggers on relation. We do this only
* to give a nice error message if there's already a trigger of the same
* Scan pg_trigger for existing triggers on relation. We do this only to
* give a nice error message if there's already a trigger of the same
* name. (The unique index on tgrelid/tgname would complain anyway.)
*
* NOTE that this is cool only because we have AccessExclusiveLock on the
@@ -857,12 +857,12 @@ RemoveTriggerById(Oid trigOid)
/*
* We do not bother to try to determine whether any other triggers remain,
* which would be needed in order to decide whether it's safe to clear
* the relation's relhastriggers. (In any case, there might be a
* concurrent process adding new triggers.) Instead, just force a
* relcache inval to make other backends (and this one too!) rebuild
* their relcache entries. There's no great harm in leaving relhastriggers
* true even if there are no triggers left.
* which would be needed in order to decide whether it's safe to clear the
* relation's relhastriggers. (In any case, there might be a concurrent
* process adding new triggers.) Instead, just force a relcache inval to
* make other backends (and this one too!) rebuild their relcache entries.
* There's no great harm in leaving relhastriggers true even if there are
* no triggers left.
*/
CacheInvalidateRelcache(rel);
@@ -1118,8 +1118,8 @@ RelationBuildTriggers(Relation relation)
int i;
/*
* Allocate a working array to hold the triggers (the array is extended
* if necessary)
* Allocate a working array to hold the triggers (the array is extended if
* necessary)
*/
maxtrigs = 16;
triggers = (Trigger *) palloc(maxtrigs * sizeof(Trigger));
@@ -2095,8 +2095,8 @@ ExecBSTruncateTriggers(EState *estate, ResultRelInfo *relinfo)
if (newtuple)
ereport(ERROR,
(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
errmsg("BEFORE STATEMENT trigger cannot return a value")));
(errcode(ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED),
errmsg("BEFORE STATEMENT trigger cannot return a value")));
}
}
@@ -2264,7 +2264,7 @@ typedef SetConstraintStateData *SetConstraintState;
* Per-trigger-event data
*
* The actual per-event data, AfterTriggerEventData, includes DONE/IN_PROGRESS
* status bits and one or two tuple CTIDs. Each event record also has an
* status bits and one or two tuple CTIDs. Each event record also has an
* associated AfterTriggerSharedData that is shared across all instances
* of similar events within a "chunk".
*
@@ -2278,12 +2278,13 @@ typedef SetConstraintStateData *SetConstraintState;
* Although this is mutable state, we can keep it in AfterTriggerSharedData
* because all instances of the same type of event in a given event list will
* be fired at the same time, if they were queued between the same firing
* cycles. So we need only ensure that ats_firing_id is zero when attaching
* cycles. So we need only ensure that ats_firing_id is zero when attaching
* a new event to an existing AfterTriggerSharedData record.
*/
typedef uint32 TriggerFlags;
#define AFTER_TRIGGER_OFFSET 0x0FFFFFFF /* must be low-order bits */
#define AFTER_TRIGGER_OFFSET 0x0FFFFFFF /* must be low-order
* bits */
#define AFTER_TRIGGER_2CTIDS 0x10000000
#define AFTER_TRIGGER_DONE 0x20000000
#define AFTER_TRIGGER_IN_PROGRESS 0x40000000
@@ -2324,13 +2325,13 @@ typedef struct AfterTriggerEventDataOneCtid
/*
* To avoid palloc overhead, we keep trigger events in arrays in successively-
* larger chunks (a slightly more sophisticated version of an expansible
* array). The space between CHUNK_DATA_START and freeptr is occupied by
* array). The space between CHUNK_DATA_START and freeptr is occupied by
* AfterTriggerEventData records; the space between endfree and endptr is
* occupied by AfterTriggerSharedData records.
*/
typedef struct AfterTriggerEventChunk
{
struct AfterTriggerEventChunk *next; /* list link */
struct AfterTriggerEventChunk *next; /* list link */
char *freeptr; /* start of free space in chunk */
char *endfree; /* end of free space in chunk */
char *endptr; /* end of chunk */
@@ -2555,9 +2556,9 @@ afterTriggerAddEvent(AfterTriggerEventList *events,
/* check number of shared records in preceding chunk */
if ((chunk->endptr - chunk->endfree) <=
(100 * sizeof(AfterTriggerSharedData)))
chunksize *= 2; /* okay, double it */
chunksize *= 2; /* okay, double it */
else
chunksize /= 2; /* too many shared records */
chunksize /= 2; /* too many shared records */
chunksize = Min(chunksize, MAX_CHUNK_SIZE);
}
chunk = MemoryContextAlloc(afterTriggers->event_cxt, chunksize);
@@ -2574,8 +2575,8 @@ afterTriggerAddEvent(AfterTriggerEventList *events,
}
/*
* Try to locate a matching shared-data record already in the chunk.
* If none, make a new one.
* Try to locate a matching shared-data record already in the chunk. If
* none, make a new one.
*/
for (newshared = ((AfterTriggerShared) chunk->endptr) - 1;
(char *) newshared >= chunk->endfree;
@@ -2590,7 +2591,7 @@ afterTriggerAddEvent(AfterTriggerEventList *events,
if ((char *) newshared < chunk->endfree)
{
*newshared = *evtshared;
newshared->ats_firing_id = 0; /* just to be sure */
newshared->ats_firing_id = 0; /* just to be sure */
chunk->endfree = (char *) newshared;
}
@@ -2658,6 +2659,7 @@ afterTriggerRestoreEventList(AfterTriggerEventList *events,
/* and clean up the tail chunk to be the right length */
events->tail->next = NULL;
events->tail->freeptr = events->tailfree;
/*
* We don't make any effort to remove now-unused shared data records.
* They might still be useful, anyway.
@@ -2940,7 +2942,7 @@ afterTriggerInvokeEvents(AfterTriggerEventList *events,
trigdesc = rInfo->ri_TrigDesc;
finfo = rInfo->ri_TrigFunctions;
instr = rInfo->ri_TrigInstrument;
if (trigdesc == NULL) /* should not happen */
if (trigdesc == NULL) /* should not happen */
elog(ERROR, "relation %u has no triggers",
evtshared->ats_relid);
}
@@ -3015,7 +3017,7 @@ AfterTriggerBeginXact(void)
MemoryContextAlloc(TopTransactionContext,
sizeof(AfterTriggersData));
afterTriggers->firing_counter = (CommandId) 1; /* mustn't be 0 */
afterTriggers->firing_counter = (CommandId) 1; /* mustn't be 0 */
afterTriggers->state = SetConstraintStateCreate(8);
afterTriggers->events.head = NULL;
afterTriggers->events.tail = NULL;
@@ -3348,8 +3350,8 @@ AfterTriggerEndSubXact(bool isCommit)
else
{
/*
* Aborting. Release any event lists from queries being aborted,
* and restore query_depth to its pre-subxact value.
* Aborting. Release any event lists from queries being aborted, and
* restore query_depth to its pre-subxact value.
*/
while (afterTriggers->query_depth > afterTriggers->depth_stack[my_level])
{
@@ -3721,7 +3723,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
/*
* Make sure a snapshot has been established in case trigger
* functions need one. Note that we avoid setting a snapshot if
* functions need one. Note that we avoid setting a snapshot if
* we don't find at least one trigger that has to be fired now.
* This is so that BEGIN; SET CONSTRAINTS ...; SET TRANSACTION
* ISOLATION LEVEL SERIALIZABLE; ... works properly. (If we are

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.16 2009/01/22 20:16:02 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/tsearchcmds.c,v 1.17 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -275,7 +275,7 @@ void
RemoveTSParsers(DropStmt *drop)
{
ObjectAddresses *objects;
ListCell *cell;
ListCell *cell;
if (!superuser())
ereport(ERROR,
@@ -284,14 +284,14 @@ RemoveTSParsers(DropStmt *drop)
/*
* First we identify all the objects, then we delete them in a single
* performMultipleDeletions() call. This is to avoid unwanted
* DROP RESTRICT errors if one of the objects depends on another.
* performMultipleDeletions() call. This is to avoid unwanted DROP
* RESTRICT errors if one of the objects depends on another.
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
List *names = (List *) lfirst(cell);
List *names = (List *) lfirst(cell);
Oid prsOid;
ObjectAddress object;
@@ -309,8 +309,8 @@ RemoveTSParsers(DropStmt *drop)
else
{
ereport(NOTICE,
(errmsg("text search parser \"%s\" does not exist, skipping",
NameListToString(names))));
(errmsg("text search parser \"%s\" does not exist, skipping",
NameListToString(names))));
}
continue;
}
@@ -636,18 +636,18 @@ void
RemoveTSDictionaries(DropStmt *drop)
{
ObjectAddresses *objects;
ListCell *cell;
ListCell *cell;
/*
* First we identify all the objects, then we delete them in a single
* performMultipleDeletions() call. This is to avoid unwanted
* DROP RESTRICT errors if one of the objects depends on another.
* performMultipleDeletions() call. This is to avoid unwanted DROP
* RESTRICT errors if one of the objects depends on another.
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
List *names = (List *) lfirst(cell);
List *names = (List *) lfirst(cell);
Oid dictOid;
ObjectAddress object;
HeapTuple tup;
@@ -661,14 +661,14 @@ RemoveTSDictionaries(DropStmt *drop)
{
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("text search dictionary \"%s\" does not exist",
NameListToString(names))));
errmsg("text search dictionary \"%s\" does not exist",
NameListToString(names))));
}
else
{
ereport(NOTICE,
(errmsg("text search dictionary \"%s\" does not exist, skipping",
NameListToString(names))));
(errmsg("text search dictionary \"%s\" does not exist, skipping",
NameListToString(names))));
}
continue;
}
@@ -676,7 +676,7 @@ RemoveTSDictionaries(DropStmt *drop)
tup = SearchSysCache(TSDICTOID,
ObjectIdGetDatum(dictOid),
0, 0, 0);
if (!HeapTupleIsValid(tup)) /* should not happen */
if (!HeapTupleIsValid(tup)) /* should not happen */
elog(ERROR, "cache lookup failed for text search dictionary %u",
dictOid);
@@ -824,7 +824,7 @@ AlterTSDictionary(AlterTSDictionaryStmt *stmt)
repl_repl[Anum_pg_ts_dict_dictinitoption - 1] = true;
newtup = heap_modify_tuple(tup, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &newtup->t_self, newtup);
@@ -1127,7 +1127,7 @@ void
RemoveTSTemplates(DropStmt *drop)
{
ObjectAddresses *objects;
ListCell *cell;
ListCell *cell;
if (!superuser())
ereport(ERROR,
@@ -1136,14 +1136,14 @@ RemoveTSTemplates(DropStmt *drop)
/*
* First we identify all the objects, then we delete them in a single
* performMultipleDeletions() call. This is to avoid unwanted
* DROP RESTRICT errors if one of the objects depends on another.
* performMultipleDeletions() call. This is to avoid unwanted DROP
* RESTRICT errors if one of the objects depends on another.
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
List *names = (List *) lfirst(cell);
List *names = (List *) lfirst(cell);
Oid tmplOid;
ObjectAddress object;
@@ -1534,18 +1534,18 @@ void
RemoveTSConfigurations(DropStmt *drop)
{
ObjectAddresses *objects;
ListCell *cell;
ListCell *cell;
/*
* First we identify all the objects, then we delete them in a single
* performMultipleDeletions() call. This is to avoid unwanted
* DROP RESTRICT errors if one of the objects depends on another.
* performMultipleDeletions() call. This is to avoid unwanted DROP
* RESTRICT errors if one of the objects depends on another.
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
List *names = (List *) lfirst(cell);
List *names = (List *) lfirst(cell);
Oid cfgOid;
Oid namespaceId;
ObjectAddress object;
@@ -1559,8 +1559,8 @@ RemoveTSConfigurations(DropStmt *drop)
{
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("text search configuration \"%s\" does not exist",
NameListToString(names))));
errmsg("text search configuration \"%s\" does not exist",
NameListToString(names))));
}
else
{
@@ -1923,8 +1923,8 @@ MakeConfigurationMapping(AlterTSConfigurationStmt *stmt,
repl_repl[Anum_pg_ts_config_map_mapdict - 1] = true;
newtup = heap_modify_tuple(maptup,
RelationGetDescr(relMap),
repl_val, repl_null, repl_repl);
RelationGetDescr(relMap),
repl_val, repl_null, repl_repl);
simple_heap_update(relMap, &newtup->t_self, newtup);
CatalogUpdateIndexes(relMap, newtup);

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.133 2009/04/04 21:12:31 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.134 2009/06/11 14:48:56 momjian Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -115,23 +115,23 @@ DefineType(List *names, List *parameters)
bool byValue = false;
char alignment = 'i'; /* default alignment */
char storage = 'p'; /* default TOAST storage method */
DefElem *likeTypeEl = NULL;
DefElem *internalLengthEl = NULL;
DefElem *inputNameEl = NULL;
DefElem *outputNameEl = NULL;
DefElem *receiveNameEl = NULL;
DefElem *sendNameEl = NULL;
DefElem *typmodinNameEl = NULL;
DefElem *typmodoutNameEl = NULL;
DefElem *analyzeNameEl = NULL;
DefElem *categoryEl = NULL;
DefElem *preferredEl = NULL;
DefElem *delimiterEl = NULL;
DefElem *elemTypeEl = NULL;
DefElem *defaultValueEl = NULL;
DefElem *byValueEl = NULL;
DefElem *alignmentEl = NULL;
DefElem *storageEl = NULL;
DefElem *likeTypeEl = NULL;
DefElem *internalLengthEl = NULL;
DefElem *inputNameEl = NULL;
DefElem *outputNameEl = NULL;
DefElem *receiveNameEl = NULL;
DefElem *sendNameEl = NULL;
DefElem *typmodinNameEl = NULL;
DefElem *typmodoutNameEl = NULL;
DefElem *analyzeNameEl = NULL;
DefElem *categoryEl = NULL;
DefElem *preferredEl = NULL;
DefElem *delimiterEl = NULL;
DefElem *elemTypeEl = NULL;
DefElem *defaultValueEl = NULL;
DefElem *byValueEl = NULL;
DefElem *alignmentEl = NULL;
DefElem *storageEl = NULL;
Oid inputOid;
Oid outputOid;
Oid receiveOid = InvalidOid;
@@ -150,8 +150,8 @@ DefineType(List *names, List *parameters)
* As of Postgres 8.4, we require superuser privilege to create a base
* type. This is simple paranoia: there are too many ways to mess up the
* system with an incorrect type definition (for instance, representation
* parameters that don't match what the C code expects). In practice
* it takes superuser privilege to create the I/O functions, and so the
* parameters that don't match what the C code expects). In practice it
* takes superuser privilege to create the I/O functions, and so the
* former requirement that you own the I/O functions pretty much forced
* superuserness anyway. We're just making doubly sure here.
*
@@ -277,13 +277,13 @@ DefineType(List *names, List *parameters)
}
/*
* Now interpret the options; we do this separately so that LIKE can
* be overridden by other options regardless of the ordering in the
* parameter list.
* Now interpret the options; we do this separately so that LIKE can be
* overridden by other options regardless of the ordering in the parameter
* list.
*/
if (likeTypeEl)
{
Type likeType;
Type likeType;
Form_pg_type likeForm;
likeType = typenameType(NULL, defGetTypeName(likeTypeEl), NULL);
@@ -319,8 +319,8 @@ DefineType(List *names, List *parameters)
if (category < 32 || category > 126)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid type category \"%s\": must be simple ASCII",
p)));
errmsg("invalid type category \"%s\": must be simple ASCII",
p)));
}
if (preferredEl)
preferred = defGetBoolean(preferredEl);
@@ -351,8 +351,8 @@ DefineType(List *names, List *parameters)
/*
* Note: if argument was an unquoted identifier, parser will have
* applied translations to it, so be prepared to recognize
* translated type names as well as the nominal form.
* applied translations to it, so be prepared to recognize translated
* type names as well as the nominal form.
*/
if (pg_strcasecmp(a, "double") == 0 ||
pg_strcasecmp(a, "float8") == 0 ||
@@ -536,7 +536,7 @@ DefineType(List *names, List *parameters)
typeNamespace, /* namespace */
InvalidOid, /* relation oid (n/a here) */
0, /* relation kind (ditto) */
GetUserId(), /* owner's ID */
GetUserId(), /* owner's ID */
internalLength, /* internal size */
TYPTYPE_BASE, /* type-type (base type) */
category, /* type-category */
@@ -578,7 +578,7 @@ DefineType(List *names, List *parameters)
GetUserId(), /* owner's ID */
-1, /* internal size (always varlena) */
TYPTYPE_BASE, /* type-type (base type) */
TYPCATEGORY_ARRAY, /* type-category (array) */
TYPCATEGORY_ARRAY, /* type-category (array) */
false, /* array types are never preferred */
delimiter, /* array element delimiter */
F_ARRAY_IN, /* input procedure */
@@ -616,18 +616,18 @@ void
RemoveTypes(DropStmt *drop)
{
ObjectAddresses *objects;
ListCell *cell;
ListCell *cell;
/*
* First we identify all the types, then we delete them in a single
* performMultipleDeletions() call. This is to avoid unwanted
* DROP RESTRICT errors if one of the types depends on another.
* performMultipleDeletions() call. This is to avoid unwanted DROP
* RESTRICT errors if one of the types depends on another.
*/
objects = new_object_addresses();
foreach(cell, drop->objects)
{
List *names = (List *) lfirst(cell);
List *names = (List *) lfirst(cell);
TypeName *typename;
Oid typeoid;
HeapTuple tup;
@@ -1020,7 +1020,7 @@ DefineDomain(CreateDomainStmt *stmt)
domainNamespace, /* namespace */
InvalidOid, /* relation oid (n/a here) */
0, /* relation kind (ditto) */
GetUserId(), /* owner's ID */
GetUserId(), /* owner's ID */
internalLength, /* internal size */
TYPTYPE_DOMAIN, /* type-type (domain type) */
category, /* type-category */
@@ -1134,7 +1134,7 @@ DefineEnum(CreateEnumStmt *stmt)
enumNamespace, /* namespace */
InvalidOid, /* relation oid (n/a here) */
0, /* relation kind (ditto) */
GetUserId(), /* owner's ID */
GetUserId(), /* owner's ID */
sizeof(Oid), /* internal size */
TYPTYPE_ENUM, /* type-type (enum type) */
TYPCATEGORY_ENUM, /* type-category (enum type) */
@@ -1176,7 +1176,7 @@ DefineEnum(CreateEnumStmt *stmt)
GetUserId(), /* owner's ID */
-1, /* internal size (always varlena) */
TYPTYPE_BASE, /* type-type (base type) */
TYPCATEGORY_ARRAY, /* type-category (array) */
TYPCATEGORY_ARRAY, /* type-category (array) */
false, /* array types are never preferred */
DEFAULT_TYPDELIM, /* array element delimiter */
F_ARRAY_IN, /* input procedure */
@@ -1610,8 +1610,8 @@ AlterDomainDefault(List *names, Node *defaultRaw)
}
newtuple = heap_modify_tuple(tup, RelationGetDescr(rel),
new_record, new_record_nulls,
new_record_repl);
new_record, new_record_nulls,
new_record_repl);
simple_heap_update(rel, &tup->t_self, newtuple);
@@ -2472,8 +2472,8 @@ RenameType(List *names, const char *newTypeName)
/*
* If it's a composite type, we need to check that it really is a
* free-standing composite type, and not a table's rowtype. We
* want people to use ALTER TABLE not ALTER TYPE for that case.
* free-standing composite type, and not a table's rowtype. We want people
* to use ALTER TABLE not ALTER TYPE for that case.
*/
if (typTup->typtype == TYPTYPE_COMPOSITE &&
get_rel_relkind(typTup->typrelid) != RELKIND_COMPOSITE_TYPE)
@@ -2493,7 +2493,7 @@ RenameType(List *names, const char *newTypeName)
errhint("You can alter type %s, which will alter the array type as well.",
format_type_be(typTup->typelem))));
/*
/*
* If type is composite we need to rename associated pg_class entry too.
* RenameRelationInternal will call RenameTypeInternal automatically.
*/

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.186 2009/01/30 17:24:47 heikki Exp $
* $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.187 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -684,7 +684,7 @@ AlterRole(AlterRoleStmt *stmt)
}
new_tuple = heap_modify_tuple(tuple, pg_authid_dsc, new_record,
new_record_nulls, new_record_repl);
new_record_nulls, new_record_repl);
simple_heap_update(pg_authid_rel, &tuple->t_self, new_tuple);
/* Update indexes */
@@ -802,7 +802,7 @@ AlterRoleSet(AlterRoleSetStmt *stmt)
}
newtuple = heap_modify_tuple(oldtuple, RelationGetDescr(rel),
repl_val, repl_null, repl_repl);
repl_val, repl_null, repl_repl);
simple_heap_update(rel, &oldtuple->t_self, newtuple);
CatalogUpdateIndexes(rel, newtuple);
@@ -1143,7 +1143,7 @@ GrantRole(GrantRoleStmt *stmt)
if (rolename == NULL || priv->cols != NIL)
ereport(ERROR,
(errcode(ERRCODE_INVALID_GRANT_OPERATION),
errmsg("column names cannot be included in GRANT/REVOKE ROLE")));
errmsg("column names cannot be included in GRANT/REVOKE ROLE")));
roleid = get_roleid_checked(rolename);
if (stmt->is_grant)
@@ -1366,8 +1366,8 @@ AddRoleMems(const char *rolename, Oid roleid,
new_record_repl[Anum_pg_auth_members_grantor - 1] = true;
new_record_repl[Anum_pg_auth_members_admin_option - 1] = true;
tuple = heap_modify_tuple(authmem_tuple, pg_authmem_dsc,
new_record,
new_record_nulls, new_record_repl);
new_record,
new_record_nulls, new_record_repl);
simple_heap_update(pg_authmem_rel, &tuple->t_self, tuple);
CatalogUpdateIndexes(pg_authmem_rel, tuple);
ReleaseSysCache(authmem_tuple);
@@ -1375,7 +1375,7 @@ AddRoleMems(const char *rolename, Oid roleid,
else
{
tuple = heap_form_tuple(pg_authmem_dsc,
new_record, new_record_nulls);
new_record, new_record_nulls);
simple_heap_insert(pg_authmem_rel, tuple);
CatalogUpdateIndexes(pg_authmem_rel, tuple);
}
@@ -1485,8 +1485,8 @@ DelRoleMems(const char *rolename, Oid roleid,
new_record_repl[Anum_pg_auth_members_admin_option - 1] = true;
tuple = heap_modify_tuple(authmem_tuple, pg_authmem_dsc,
new_record,
new_record_nulls, new_record_repl);
new_record,
new_record_nulls, new_record_repl);
simple_heap_update(pg_authmem_rel, &tuple->t_self, tuple);
CatalogUpdateIndexes(pg_authmem_rel, tuple);
}

View File

@@ -13,7 +13,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.388 2009/06/06 22:13:51 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.389 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -655,7 +655,7 @@ vacuum_set_xid_limits(int freeze_min_age,
if (freezeTableLimit != NULL)
{
int freezetable;
int freezetable;
/*
* Determine the table freeze age to use: as specified by the caller,
@@ -671,8 +671,8 @@ vacuum_set_xid_limits(int freeze_min_age,
Assert(freezetable >= 0);
/*
* Compute the cutoff XID, being careful not to generate a
* "permanent" XID.
* Compute the cutoff XID, being careful not to generate a "permanent"
* XID.
*/
limit = ReadNewTransactionId() - freezetable;
if (!TransactionIdIsNormal(limit))
@@ -1031,16 +1031,16 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
StartTransactionCommand();
/*
* Functions in indexes may want a snapshot set. Also, setting
* a snapshot ensures that RecentGlobalXmin is kept truly recent.
* Functions in indexes may want a snapshot set. Also, setting a snapshot
* ensures that RecentGlobalXmin is kept truly recent.
*/
PushActiveSnapshot(GetTransactionSnapshot());
if (!vacstmt->full)
{
/*
* In lazy vacuum, we can set the PROC_IN_VACUUM flag, which lets other
* concurrent VACUUMs know that they can ignore this one while
* In lazy vacuum, we can set the PROC_IN_VACUUM flag, which lets
* other concurrent VACUUMs know that they can ignore this one while
* determining their OldestXmin. (The reason we don't set it during a
* full VACUUM is exactly that we may have to run user- defined
* functions for functional indexes, and we want to make sure that if
@@ -1049,9 +1049,9 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
* contents of other tables is arguably broken, but we won't break it
* here by violating transaction semantics.)
*
* We also set the VACUUM_FOR_WRAPAROUND flag, which is passed down
* by autovacuum; it's used to avoid cancelling a vacuum that was
* invoked in an emergency.
* We also set the VACUUM_FOR_WRAPAROUND flag, which is passed down by
* autovacuum; it's used to avoid cancelling a vacuum that was invoked
* in an emergency.
*
* Note: these flags remain set until CommitTransaction or
* AbortTransaction. We don't want to clear them until we reset
@@ -1108,8 +1108,8 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
{
if (onerel->rd_rel->relisshared)
ereport(WARNING,
(errmsg("skipping \"%s\" --- only superuser can vacuum it",
RelationGetRelationName(onerel))));
(errmsg("skipping \"%s\" --- only superuser can vacuum it",
RelationGetRelationName(onerel))));
else if (onerel->rd_rel->relnamespace == PG_CATALOG_NAMESPACE)
ereport(WARNING,
(errmsg("skipping \"%s\" --- only superuser or database owner can vacuum it",
@@ -1125,8 +1125,9 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
}
/*
* Check that it's a vacuumable table; we used to do this in get_rel_oids()
* but seems safer to check after we've locked the relation.
* Check that it's a vacuumable table; we used to do this in
* get_rel_oids() but seems safer to check after we've locked the
* relation.
*/
if (onerel->rd_rel->relkind != RELKIND_RELATION &&
onerel->rd_rel->relkind != RELKIND_TOASTVALUE)
@@ -1178,9 +1179,8 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound,
toast_relid = InvalidOid;
/*
* Switch to the table owner's userid, so that any index functions are
* run as that user. (This is unnecessary, but harmless, for lazy
* VACUUM.)
* Switch to the table owner's userid, so that any index functions are run
* as that user. (This is unnecessary, but harmless, for lazy VACUUM.)
*/
GetUserIdAndContext(&save_userid, &save_secdefcxt);
SetUserIdAndContext(onerel->rd_rel->relowner, true);
@@ -1740,13 +1740,13 @@ scan_heap(VRelStats *vacrelstats, Relation onerel,
/*
* Add the page to vacuum_pages if it requires reaping, and add it to
* fraged_pages if it has a useful amount of free space. "Useful"
* means enough for a minimal-sized tuple. But we don't know that
* means enough for a minimal-sized tuple. But we don't know that
* accurately near the start of the relation, so add pages
* unconditionally if they have >= BLCKSZ/10 free space. Also
* forcibly add pages with no live tuples, to avoid confusing the
* empty_end_pages logic. (In the presence of unreasonably small
* fillfactor, it seems possible that such pages might not pass
* the free-space test, but they had better be in the list anyway.)
* fillfactor, it seems possible that such pages might not pass the
* free-space test, but they had better be in the list anyway.)
*/
do_frag = (vacpage->free >= min_tlen || vacpage->free >= BLCKSZ / 10 ||
notup);
@@ -2228,7 +2228,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
/* assume block# is OK (see heap_fetch comments) */
nextBuf = ReadBufferExtended(onerel, MAIN_FORKNUM,
ItemPointerGetBlockNumber(&nextTid),
RBM_NORMAL, vac_strategy);
RBM_NORMAL, vac_strategy);
nextPage = BufferGetPage(nextBuf);
/* If bogus or unused slot, assume tp is end of chain */
nextOffnum = ItemPointerGetOffsetNumber(&nextTid);
@@ -2373,7 +2373,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
tp.t_self = vtlp->this_tid;
Pbuf = ReadBufferExtended(onerel, MAIN_FORKNUM,
ItemPointerGetBlockNumber(&(tp.t_self)),
RBM_NORMAL, vac_strategy);
RBM_NORMAL, vac_strategy);
Ppage = BufferGetPage(Pbuf);
Pitemid = PageGetItemId(Ppage,
ItemPointerGetOffsetNumber(&(tp.t_self)));
@@ -2457,7 +2457,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel,
tuple.t_self = vtmove[ti].tid;
Cbuf = ReadBufferExtended(onerel, MAIN_FORKNUM,
ItemPointerGetBlockNumber(&(tuple.t_self)),
RBM_NORMAL, vac_strategy);
RBM_NORMAL, vac_strategy);
/* Get page to move to */
dst_buffer = ReadBufferExtended(onerel, MAIN_FORKNUM,
@@ -3400,8 +3400,8 @@ scan_index(Relation indrel, double num_tuples)
return;
/*
* Now update statistics in pg_class, but only if the index says the
* count is accurate.
* Now update statistics in pg_class, but only if the index says the count
* is accurate.
*/
if (!stats->estimated_count)
vac_update_relstats(indrel,
@@ -3477,8 +3477,8 @@ vacuum_index(VacPageList vacpagelist, Relation indrel,
return;
/*
* Now update statistics in pg_class, but only if the index says the
* count is accurate.
* Now update statistics in pg_class, but only if the index says the count
* is accurate.
*/
if (!stats->estimated_count)
vac_update_relstats(indrel,
@@ -3835,7 +3835,7 @@ PageGetFreeSpaceWithFillFactor(Relation relation, Page page)
{
/*
* It is correct to use PageGetExactFreeSpace() here, *not*
* PageGetHeapFreeSpace(). This is because (a) we do our own, exact
* PageGetHeapFreeSpace(). This is because (a) we do our own, exact
* accounting for whether line pointers must be added, and (b) we will
* recycle any LP_DEAD line pointers before starting to add rows to a
* page, but that may not have happened yet at the time this function is

View File

@@ -29,7 +29,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.120 2009/06/06 22:13:51 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.121 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -87,7 +87,7 @@ typedef struct LVRelStats
bool scanned_all; /* have we scanned all pages (this far)? */
/* Overall statistics about rel */
BlockNumber rel_pages;
double old_rel_tuples; /* previous value of pg_class.reltuples */
double old_rel_tuples; /* previous value of pg_class.reltuples */
double rel_tuples; /* counts only tuples on scanned pages */
BlockNumber pages_removed;
double tuples_deleted;
@@ -175,14 +175,14 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
vacrelstats = (LVRelStats *) palloc0(sizeof(LVRelStats));
vacrelstats->scanned_all = true; /* will be cleared if we skip a page */
vacrelstats->scanned_all = true; /* will be cleared if we skip a page */
vacrelstats->old_rel_tuples = onerel->rd_rel->reltuples;
vacrelstats->num_index_scans = 0;
/* Open all indexes of the relation */
vac_open_indexes(onerel, RowExclusiveLock, &nindexes, &Irel);
vacrelstats->hasindex = (nindexes > 0);
/* Do the vacuuming */
lazy_scan_heap(onerel, vacrelstats, Irel, nindexes, scan_all);
@@ -208,9 +208,9 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
* Update statistics in pg_class. But only if we didn't skip any pages;
* the tuple count only includes tuples from the pages we've visited, and
* we haven't frozen tuples in unvisited pages either. The page count is
* accurate in any case, but because we use the reltuples / relpages
* ratio in the planner, it's better to not update relpages either if we
* can't update reltuples.
* accurate in any case, but because we use the reltuples / relpages ratio
* in the planner, it's better to not update relpages either if we can't
* update reltuples.
*/
if (vacrelstats->scanned_all)
vac_update_relstats(onerel,
@@ -279,7 +279,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
int i;
PGRUsage ru0;
Buffer vmbuffer = InvalidBuffer;
BlockNumber all_visible_streak;
BlockNumber all_visible_streak;
pg_rusage_init(&ru0);
@@ -318,8 +318,8 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
bool all_visible;
/*
* Skip pages that don't require vacuuming according to the
* visibility map. But only if we've seen a streak of at least
* Skip pages that don't require vacuuming according to the visibility
* map. But only if we've seen a streak of at least
* SKIP_PAGES_THRESHOLD pages marked as clean. Since we're reading
* sequentially, the OS should be doing readahead for us and there's
* no gain in skipping a page now and then. You need a longer run of
@@ -558,9 +558,10 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
all_visible = false;
break;
}
/*
* The inserter definitely committed. But is it
* old enough that everyone sees it as committed?
* The inserter definitely committed. But is it old
* enough that everyone sees it as committed?
*/
xmin = HeapTupleHeaderGetXmin(tuple.t_data);
if (!TransactionIdPrecedes(xmin, OldestXmin))
@@ -922,8 +923,8 @@ lazy_cleanup_index(Relation indrel,
return;
/*
* Now update statistics in pg_class, but only if the index says the
* count is accurate.
* Now update statistics in pg_class, but only if the index says the count
* is accurate.
*/
if (!stats->estimated_count)
vac_update_relstats(indrel,

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.129 2009/01/01 17:23:40 momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.130 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -268,7 +268,7 @@ assign_timezone(const char *value, bool doit, GucSource source)
/*
* Try to parse it. XXX an invalid interval format will result in
* ereport(ERROR), which is not desirable for GUC. We did what we
* ereport(ERROR), which is not desirable for GUC. We did what we
* could to guard against this in flatten_set_variable_args, but a
* string coming in from postgresql.conf might contain anything.
*/
@@ -290,7 +290,7 @@ assign_timezone(const char *value, bool doit, GucSource source)
{
ereport(GUC_complaint_elevel(source),
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid interval value for time zone: day not allowed")));
errmsg("invalid interval value for time zone: day not allowed")));
pfree(interval);
return NULL;
}
@@ -843,7 +843,7 @@ assign_role(const char *value, bool doit, GucSource source)
/*
* Disallow SET ROLE inside a security definer context. We need to do
* this because when we exit the context, GUC won't be notified,
* leaving things out of sync. Note that this test is arranged so
* leaving things out of sync. Note that this test is arranged so
* that restoring a previously saved setting isn't prevented.
*
* XXX it would be nice to allow this case in future, with the

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.115 2009/04/04 21:12:31 tgl Exp $
* $PostgreSQL: pgsql/src/backend/commands/view.c,v 1.116 2009/06/11 14:48:56 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -185,14 +185,14 @@ DefineVirtualRelation(const RangeVar *relation, List *tlist, bool replace)
checkViewTupleDesc(descriptor, rel->rd_att);
/*
* If new attributes have been added, we must add pg_attribute entries
* If new attributes have been added, we must add pg_attribute entries
* for them. It is convenient (although overkill) to use the ALTER
* TABLE ADD COLUMN infrastructure for this.
*/
if (list_length(attrList) > rel->rd_att->natts)
{
List *atcmds = NIL;
ListCell *c;
List *atcmds = NIL;
ListCell *c;
int skip = rel->rd_att->natts;
foreach(c, attrList)
@@ -273,9 +273,9 @@ checkViewTupleDesc(TupleDesc newdesc, TupleDesc olddesc)
if (strcmp(NameStr(newattr->attname), NameStr(oldattr->attname)) != 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
errmsg("cannot change name of view column \"%s\" to \"%s\"",
NameStr(oldattr->attname),
NameStr(newattr->attname))));
errmsg("cannot change name of view column \"%s\" to \"%s\"",
NameStr(oldattr->attname),
NameStr(newattr->attname))));
/* XXX would it be safe to allow atttypmod to change? Not sure */
if (newattr->atttypid != oldattr->atttypid ||
newattr->atttypmod != oldattr->atttypmod)