mirror of
https://github.com/postgres/postgres.git
synced 2025-07-20 05:03:10 +03:00
Remove tabs after spaces in C comments
This was not changed in HEAD, but will be done later as part of a pgindent run. Future pgindent runs will also do this. Report by Tom Lane Backpatch through all supported branches, but not HEAD
This commit is contained in:
@ -173,7 +173,7 @@ 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
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* Executes an ALTER OBJECT / RENAME TO statement. Based on the object
|
||||
* Executes an ALTER OBJECT / RENAME TO statement. Based on the object
|
||||
* type, the function appropriate to that type is executed.
|
||||
*/
|
||||
void
|
||||
|
@ -351,7 +351,7 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh)
|
||||
|
||||
/*
|
||||
* Open all indexes of the relation, and see if there are any analyzable
|
||||
* columns in the indexes. We do not analyze index columns if there was
|
||||
* columns in the indexes. We do not analyze index columns if there was
|
||||
* an explicit column list in the ANALYZE command, however. If we are
|
||||
* doing a recursive scan, we don't want to touch the parent's indexes at
|
||||
* all.
|
||||
@ -408,7 +408,7 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh)
|
||||
|
||||
/*
|
||||
* Determine how many rows we need to sample, using the worst case from
|
||||
* all analyzable columns. We use a lower bound of 100 rows to avoid
|
||||
* all analyzable columns. We use a lower bound of 100 rows to avoid
|
||||
* possible overflow in Vitter's algorithm. (Note: that will also be
|
||||
* the target in the corner case where there are no analyzable columns.)
|
||||
*/
|
||||
@ -441,7 +441,7 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh)
|
||||
&totalrows, &totaldeadrows);
|
||||
|
||||
/*
|
||||
* Compute the statistics. Temporary results during the calculations for
|
||||
* Compute the statistics. Temporary results during the calculations for
|
||||
* each column are stored in a child context. The calc routines are
|
||||
* responsible to make sure that whatever they store into the VacAttrStats
|
||||
* structure is allocated in anl_context.
|
||||
@ -498,7 +498,7 @@ do_analyze_rel(Relation onerel, VacuumStmt *vacstmt, bool inh)
|
||||
|
||||
/*
|
||||
* Emit the completed stats rows into pg_statistic, replacing any
|
||||
* previous statistics for the target columns. (If there are stats in
|
||||
* previous statistics for the target columns. (If there are stats in
|
||||
* pg_statistic for columns we didn't process, we leave them alone.)
|
||||
*/
|
||||
update_attstats(RelationGetRelid(onerel), inh,
|
||||
@ -804,7 +804,7 @@ examine_attribute(Relation onerel, int attnum, Node *index_expr)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* Create the VacAttrStats struct. Note that we only have a copy of the
|
||||
* 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));
|
||||
@ -853,7 +853,7 @@ examine_attribute(Relation onerel, int attnum, Node *index_expr)
|
||||
}
|
||||
|
||||
/*
|
||||
* Call the type-specific typanalyze function. If none is specified, use
|
||||
* Call the type-specific typanalyze function. If none is specified, use
|
||||
* std_typanalyze().
|
||||
*/
|
||||
if (OidIsValid(stats->attrtype->typanalyze))
|
||||
@ -929,7 +929,7 @@ BlockSampler_Next(BlockSampler bs)
|
||||
* If we are to skip, we should advance t (hence decrease K), and
|
||||
* repeat the same probabilistic test for the next block. The naive
|
||||
* implementation thus requires a random_fract() call for each block
|
||||
* number. But we can reduce this to one random_fract() call per
|
||||
* number. But we can reduce this to one random_fract() call per
|
||||
* selected block, by noting that each time the while-test succeeds,
|
||||
* we can reinterpret V as a uniform random number in the range 0 to p.
|
||||
* Therefore, instead of choosing a new V, we just adjust p to be
|
||||
@ -1058,7 +1058,7 @@ 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
|
||||
* run to get rid of them. Note that this rule agrees with the
|
||||
* way that heap_page_prune() counts things.
|
||||
*/
|
||||
if (!ItemIdIsNormal(itemid))
|
||||
@ -1103,7 +1103,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
|
||||
* 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
|
||||
@ -1145,7 +1145,7 @@ acquire_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
|
||||
/*
|
||||
* The first targrows sample rows are simply copied into the
|
||||
* reservoir. Then we start replacing tuples in the sample
|
||||
* until we reach the end of the relation. This algorithm is
|
||||
* until we reach the end of the relation. This algorithm is
|
||||
* from Jeff Vitter's paper (see full citation below). It
|
||||
* works by repeatedly computing the number of tuples to skip
|
||||
* before selecting a tuple, which replaces a randomly chosen
|
||||
@ -1523,7 +1523,7 @@ acquire_inherited_sample_rows(Relation onerel, HeapTuple *rows, int targrows,
|
||||
* Statistics are stored in several places: the pg_class row for the
|
||||
* relation has stats about the whole relation, and there is a
|
||||
* pg_statistic row for each (non-system) attribute that has ever
|
||||
* been analyzed. The pg_class values are updated by VACUUM, not here.
|
||||
* been analyzed. The pg_class values are updated by VACUUM, not here.
|
||||
*
|
||||
* pg_statistic rows are just added or updated normally. This means
|
||||
* that pg_statistic will probably contain some deleted rows at the
|
||||
@ -1924,7 +1924,7 @@ compute_minimal_stats(VacAttrStatsP stats,
|
||||
/*
|
||||
* If the value is toasted, we want to detoast it just once to
|
||||
* avoid repeated detoastings and resultant excess memory usage
|
||||
* during the comparisons. Also, check to see if the value is
|
||||
* during the comparisons. Also, check to see if the value is
|
||||
* excessively wide, and if so don't detoast at all --- just
|
||||
* ignore the value.
|
||||
*/
|
||||
@ -2041,7 +2041,7 @@ compute_minimal_stats(VacAttrStatsP stats,
|
||||
* We assume (not very reliably!) that all the multiply-occurring
|
||||
* values are reflected in the final track[] list, and the other
|
||||
* nonnull values all appeared but once. (XXX this usually
|
||||
* results in a drastic overestimate of ndistinct. Can we do
|
||||
* results in a drastic overestimate of ndistinct. Can we do
|
||||
* any better?)
|
||||
*----------
|
||||
*/
|
||||
@ -2078,7 +2078,7 @@ compute_minimal_stats(VacAttrStatsP stats,
|
||||
* Decide how many values are worth storing as most-common values. If
|
||||
* we are able to generate a complete MCV list (all the values in the
|
||||
* sample will fit, and we think these are all the ones in the table),
|
||||
* then do so. Otherwise, store only those values that are
|
||||
* then do so. Otherwise, store only those values that are
|
||||
* significantly more common than the (estimated) average. We set the
|
||||
* threshold rather arbitrarily at 25% more than average, with at
|
||||
* least 2 instances in the sample.
|
||||
@ -2243,7 +2243,7 @@ compute_scalar_stats(VacAttrStatsP stats,
|
||||
/*
|
||||
* If the value is toasted, we want to detoast it just once to
|
||||
* avoid repeated detoastings and resultant excess memory usage
|
||||
* during the comparisons. Also, check to see if the value is
|
||||
* during the comparisons. Also, check to see if the value is
|
||||
* excessively wide, and if so don't detoast at all --- just
|
||||
* ignore the value.
|
||||
*/
|
||||
@ -2289,7 +2289,7 @@ compute_scalar_stats(VacAttrStatsP stats,
|
||||
* accumulate ordering-correlation statistics.
|
||||
*
|
||||
* To determine which are most common, we first have to count the
|
||||
* number of duplicates of each value. The duplicates are adjacent in
|
||||
* number of duplicates of each value. The duplicates are adjacent in
|
||||
* the sorted list, so a brute-force approach is to compare successive
|
||||
* datum values until we find two that are not equal. However, that
|
||||
* requires N-1 invocations of the datum comparison routine, which are
|
||||
@ -2298,7 +2298,7 @@ compute_scalar_stats(VacAttrStatsP stats,
|
||||
* that are adjacent in the sorted order; otherwise it could not know
|
||||
* that it's ordered the pair correctly.) We exploit this by having
|
||||
* compare_scalars remember the highest tupno index that each
|
||||
* ScalarItem has been found equal to. At the end of the sort, a
|
||||
* ScalarItem has been found equal to. At the end of the sort, a
|
||||
* ScalarItem's tupnoLink will still point to itself if and only if it
|
||||
* is the last item of its group of duplicates (since the group will
|
||||
* be ordered by tupno).
|
||||
@ -2418,7 +2418,7 @@ compute_scalar_stats(VacAttrStatsP stats,
|
||||
* Decide how many values are worth storing as most-common values. If
|
||||
* we are able to generate a complete MCV list (all the values in the
|
||||
* sample will fit, and we think these are all the ones in the table),
|
||||
* then do so. Otherwise, store only those values that are
|
||||
* then do so. Otherwise, store only those values that are
|
||||
* significantly more common than the (estimated) average. We set the
|
||||
* threshold rather arbitrarily at 25% more than average, with at
|
||||
* least 2 instances in the sample. Also, we won't suppress values
|
||||
@ -2573,7 +2573,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
|
||||
@ -2684,7 +2684,7 @@ compute_scalar_stats(VacAttrStatsP stats,
|
||||
* qsort_arg comparator for sorting ScalarItems
|
||||
*
|
||||
* Aside from sorting the items, we update the tupnoLink[] array
|
||||
* whenever two ScalarItems are found to contain equal datums. The array
|
||||
* whenever two ScalarItems are found to contain equal datums. The array
|
||||
* is indexed by tupno; for each ScalarItem, it contains the highest
|
||||
* tupno that that item's datum has been found to be equal to. This allows
|
||||
* us to avoid additional comparisons in compute_scalar_stats().
|
||||
|
@ -150,7 +150,7 @@
|
||||
*
|
||||
* This struct declaration has the maximal length, but in a real queue entry
|
||||
* the data area is only big enough for the actual channel and payload strings
|
||||
* (each null-terminated). AsyncQueueEntryEmptySize is the minimum possible
|
||||
* (each null-terminated). AsyncQueueEntryEmptySize is the minimum possible
|
||||
* entry size, if both channel and payload strings are empty (but note it
|
||||
* doesn't include alignment padding).
|
||||
*
|
||||
@ -266,7 +266,7 @@ static SlruCtlData AsyncCtlData;
|
||||
*
|
||||
* The most data we can have in the queue at a time is QUEUE_MAX_PAGE/2
|
||||
* pages, because more than that would confuse slru.c into thinking there
|
||||
* was a wraparound condition. With the default BLCKSZ this means there
|
||||
* was a wraparound condition. With the default BLCKSZ this means there
|
||||
* can be up to 8GB of queued-and-not-read data.
|
||||
*
|
||||
* Note: it's possible to redefine QUEUE_MAX_PAGE with a smaller multiple of
|
||||
@ -411,7 +411,7 @@ asyncQueuePagePrecedesLogically(int p, int q)
|
||||
int diff;
|
||||
|
||||
/*
|
||||
* We have to compare modulo (QUEUE_MAX_PAGE+1)/2. Both inputs should be
|
||||
* We have to compare modulo (QUEUE_MAX_PAGE+1)/2. Both inputs should be
|
||||
* in the range 0..QUEUE_MAX_PAGE.
|
||||
*/
|
||||
Assert(p >= 0 && p <= QUEUE_MAX_PAGE);
|
||||
@ -849,7 +849,7 @@ PreCommit_Notify(void)
|
||||
while (nextNotify != NULL)
|
||||
{
|
||||
/*
|
||||
* Add the pending notifications to the queue. We acquire and
|
||||
* Add the pending notifications to the queue. We acquire and
|
||||
* release AsyncQueueLock once per page, which might be overkill
|
||||
* but it does allow readers to get in while we're doing this.
|
||||
*
|
||||
@ -1065,12 +1065,12 @@ Exec_UnlistenAllCommit(void)
|
||||
* The reason that this is not done in AtCommit_Notify is that there is
|
||||
* a nonzero chance of errors here (for example, encoding conversion errors
|
||||
* while trying to format messages to our frontend). An error during
|
||||
* AtCommit_Notify would be a PANIC condition. The timing is also arranged
|
||||
* AtCommit_Notify would be a PANIC condition. The timing is also arranged
|
||||
* to ensure that a transaction's self-notifies are delivered to the frontend
|
||||
* before it gets the terminating ReadyForQuery message.
|
||||
*
|
||||
* Note that we send signals and process the queue even if the transaction
|
||||
* eventually aborted. This is because we need to clean out whatever got
|
||||
* eventually aborted. This is because we need to clean out whatever got
|
||||
* added to the queue.
|
||||
*
|
||||
* NOTE: we are outside of any transaction here.
|
||||
@ -1160,7 +1160,7 @@ IsListeningOn(const char *channel)
|
||||
|
||||
/*
|
||||
* Remove our entry from the listeners array when we are no longer listening
|
||||
* on any channel. NB: must not fail if we're already not listening.
|
||||
* on any channel. NB: must not fail if we're already not listening.
|
||||
*/
|
||||
static void
|
||||
asyncQueueUnregister(void)
|
||||
@ -1202,7 +1202,7 @@ asyncQueueIsFull(void)
|
||||
/*
|
||||
* The queue is full if creating a new head page would create a page that
|
||||
* logically precedes the current global tail pointer, ie, the head
|
||||
* pointer would wrap around compared to the tail. We cannot create such
|
||||
* pointer would wrap around compared to the tail. We cannot create such
|
||||
* a head page for fear of confusing slru.c. For safety we round the tail
|
||||
* pointer back to a segment boundary (compare the truncation logic in
|
||||
* asyncQueueAdvanceTail).
|
||||
@ -1221,7 +1221,7 @@ asyncQueueIsFull(void)
|
||||
|
||||
/*
|
||||
* Advance the QueuePosition to the next entry, assuming that the current
|
||||
* entry is of length entryLength. If we jump to a new page the function
|
||||
* entry is of length entryLength. If we jump to a new page the function
|
||||
* returns true, else false.
|
||||
*/
|
||||
static bool
|
||||
@ -1290,7 +1290,7 @@ asyncQueueNotificationToEntry(Notification *n, AsyncQueueEntry *qe)
|
||||
* the last byte which simplifies reading the page later.
|
||||
*
|
||||
* We are passed the list cell containing the next notification to write
|
||||
* and return the first still-unwritten cell back. Eventually we will return
|
||||
* and return the first still-unwritten cell back. Eventually we will return
|
||||
* NULL indicating all is done.
|
||||
*
|
||||
* We are holding AsyncQueueLock already from the caller and grab AsyncCtlLock
|
||||
@ -1367,7 +1367,7 @@ asyncQueueAddEntries(ListCell *nextNotify)
|
||||
* Page is full, so we're done here, but first fill the next page
|
||||
* with zeroes. The reason to do this is to ensure that slru.c's
|
||||
* idea of the head page is always the same as ours, which avoids
|
||||
* boundary problems in SimpleLruTruncate. The test in
|
||||
* boundary problems in SimpleLruTruncate. The test in
|
||||
* asyncQueueIsFull() ensured that there is room to create this
|
||||
* page without overrunning the queue.
|
||||
*/
|
||||
@ -1794,7 +1794,7 @@ EnableNotifyInterrupt(void)
|
||||
* is disabled until the next EnableNotifyInterrupt call.
|
||||
*
|
||||
* The PROCSIG_CATCHUP_INTERRUPT signal handler also needs to call this,
|
||||
* so as to prevent conflicts if one signal interrupts the other. So we
|
||||
* so as to prevent conflicts if one signal interrupts the other. So we
|
||||
* must return the previous state of the flag.
|
||||
*/
|
||||
bool
|
||||
@ -1889,7 +1889,7 @@ asyncQueueReadAllNotifications(void)
|
||||
/*
|
||||
* We copy the data from SLRU into a local buffer, so as to avoid
|
||||
* holding the AsyncCtlLock while we are examining the entries and
|
||||
* possibly transmitting them to our frontend. Copy only the part
|
||||
* possibly transmitting them to our frontend. Copy only the part
|
||||
* of the page we will actually inspect.
|
||||
*/
|
||||
slotno = SimpleLruReadPage_ReadOnly(AsyncCtl, curpage,
|
||||
@ -1963,7 +1963,7 @@ asyncQueueReadAllNotifications(void)
|
||||
* and deliver relevant ones to my frontend.
|
||||
*
|
||||
* The current page must have been fetched into page_buffer from shared
|
||||
* memory. (We could access the page right in shared memory, but that
|
||||
* memory. (We could access the page right in shared memory, but that
|
||||
* would imply holding the AsyncCtlLock throughout this routine.)
|
||||
*
|
||||
* We stop if we reach the "stop" position, or reach a notification from an
|
||||
@ -2169,7 +2169,7 @@ NotifyMyFrontEnd(const char *channel, const char *payload, int32 srcPid)
|
||||
pq_endmessage(&buf);
|
||||
|
||||
/*
|
||||
* NOTE: we do not do pq_flush() here. For a self-notify, it will
|
||||
* NOTE: we do not do pq_flush() here. For a self-notify, it will
|
||||
* happen at the end of the transaction, and for incoming notifies
|
||||
* ProcessIncomingNotify will do it after finding all the notifies.
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* cluster.c
|
||||
* CLUSTER a table on an index. This is now also used for VACUUM FULL.
|
||||
* CLUSTER a table on an index. This is now also used for VACUUM FULL.
|
||||
*
|
||||
* There is hardly anything left of Paul Brown's original implementation...
|
||||
*
|
||||
@ -92,7 +92,7 @@ static List *get_tables_to_cluster(MemoryContext cluster_context);
|
||||
*
|
||||
* The single-relation case does not have any such overhead.
|
||||
*
|
||||
* We also allow a relation to be specified without index. In that case,
|
||||
* We also allow a relation to be specified without index. In that case,
|
||||
* the indisclustered bit will be looked up, and an ERROR will be thrown
|
||||
* if there is no index with the bit set.
|
||||
*---------------------------------------------------------------------------
|
||||
@ -207,7 +207,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
|
||||
ALLOCSET_DEFAULT_MAXSIZE);
|
||||
|
||||
/*
|
||||
* Build the list of relations to cluster. Note that this lives in
|
||||
* Build the list of relations to cluster. Note that this lives in
|
||||
* cluster_context.
|
||||
*/
|
||||
rvs = get_tables_to_cluster(cluster_context);
|
||||
@ -244,7 +244,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
|
||||
*
|
||||
* This clusters the table by creating a new, clustered table and
|
||||
* swapping the relfilenodes of the new table and the old table, so
|
||||
* the OID of the original table is preserved. Thus we do not lose
|
||||
* the OID of the original table is preserved. Thus we do not lose
|
||||
* GRANT, inheritance nor references to this table (this was a bug
|
||||
* in releases thru 7.3).
|
||||
*
|
||||
@ -253,7 +253,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel)
|
||||
* them incrementally while we load the table.
|
||||
*
|
||||
* If indexOid is InvalidOid, the table will be rewritten in physical order
|
||||
* instead of index order. This is the new implementation of VACUUM FULL,
|
||||
* instead of index order. This is the new implementation of VACUUM FULL,
|
||||
* and error messages should refer to the operation as VACUUM not CLUSTER.
|
||||
*/
|
||||
void
|
||||
@ -267,7 +267,7 @@ cluster_rel(Oid tableOid, Oid indexOid, bool recheck, bool verbose,
|
||||
|
||||
/*
|
||||
* We grab exclusive access to the target rel and index for the duration
|
||||
* of the transaction. (This is redundant for the single-transaction
|
||||
* of the transaction. (This is redundant for the single-transaction
|
||||
* case, since cluster() already did it.) The index lock is taken inside
|
||||
* check_index_is_clusterable.
|
||||
*/
|
||||
@ -302,7 +302,7 @@ cluster_rel(Oid tableOid, Oid indexOid, bool recheck, bool verbose,
|
||||
* check in the "recheck" case is appropriate (which currently means
|
||||
* somebody is executing a database-wide CLUSTER), because there is
|
||||
* another check in cluster() which will stop any attempt to cluster
|
||||
* remote temp tables by name. There is another check in cluster_rel
|
||||
* remote temp tables by name. There is another check in cluster_rel
|
||||
* which is redundant, but we leave it for extra safety.
|
||||
*/
|
||||
if (RELATION_IS_OTHER_TEMP(OldHeap))
|
||||
@ -432,7 +432,7 @@ check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck)
|
||||
|
||||
/*
|
||||
* Disallow clustering on incomplete indexes (those that might not index
|
||||
* every row of the relation). We could relax this by making a separate
|
||||
* every row of the relation). We could relax this by making a separate
|
||||
* seqscan pass over the table to copy the missing rows, but that seems
|
||||
* expensive and tedious.
|
||||
*/
|
||||
@ -667,14 +667,14 @@ make_new_heap(Oid OIDOldHeap, Oid NewTableSpace)
|
||||
|
||||
/*
|
||||
* Create the new heap, using a temporary name in the same namespace as
|
||||
* the existing table. NOTE: there is some risk of collision with user
|
||||
* the existing table. NOTE: there is some risk of collision with user
|
||||
* relnames. Working around this seems more trouble than it's worth; in
|
||||
* particular, we can't create the new heap in a different namespace from
|
||||
* the old, or we will have problems with the TEMP status of temp tables.
|
||||
*
|
||||
* Note: the new heap is not a shared relation, even if we are rebuilding
|
||||
* a shared rel. However, we do make the new heap mapped if the source is
|
||||
* mapped. This simplifies swap_relation_files, and is absolutely
|
||||
* mapped. This simplifies swap_relation_files, and is absolutely
|
||||
* necessary for rebuilding pg_class, for reasons explained there.
|
||||
*/
|
||||
snprintf(NewHeapName, sizeof(NewHeapName), "pg_temp_%u", OIDOldHeap);
|
||||
@ -818,7 +818,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
|
||||
/*
|
||||
* If both tables have TOAST tables, perform toast swap by content. It is
|
||||
* possible that the old table has a toast table but the new one doesn't,
|
||||
* if toastable columns have been dropped. In that case we have to do
|
||||
* if toastable columns have been dropped. In that case we have to do
|
||||
* swap by links. This is okay because swap by content is only essential
|
||||
* for system catalogs, and we don't support schema changes for them.
|
||||
*/
|
||||
@ -837,7 +837,7 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex,
|
||||
*
|
||||
* Note that we must hold NewHeap open until we are done writing data,
|
||||
* since the relcache will not guarantee to remember this setting once
|
||||
* the relation is closed. Also, this technique depends on the fact
|
||||
* the relation is closed. Also, this technique depends on the fact
|
||||
* that no one will try to read from the NewHeap until after we've
|
||||
* finished writing it and swapping the rels --- otherwise they could
|
||||
* follow the toast pointers to the wrong place. (It would actually
|
||||
@ -1154,7 +1154,7 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
|
||||
NameStr(relform2->relname), r2);
|
||||
|
||||
/*
|
||||
* Send replacement mappings to relmapper. Note these won't actually
|
||||
* Send replacement mappings to relmapper. Note these won't actually
|
||||
* take effect until CommandCounterIncrement.
|
||||
*/
|
||||
RelationMapUpdateMap(r1, relfilenode2, relform1->relisshared, false);
|
||||
@ -1342,7 +1342,7 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
|
||||
* non-transient relation.)
|
||||
*
|
||||
* Caution: the placement of this step interacts with the decision to
|
||||
* handle toast rels by recursion. When we are trying to rebuild pg_class
|
||||
* handle toast rels by recursion. When we are trying to rebuild pg_class
|
||||
* itself, the smgr close on pg_class must happen after all accesses in
|
||||
* this function.
|
||||
*/
|
||||
@ -1386,9 +1386,9 @@ finish_heap_swap(Oid OIDOldHeap, Oid OIDNewHeap,
|
||||
|
||||
/*
|
||||
* Rebuild each index on the relation (but not the toast table, which is
|
||||
* all-new at this point). It is important to do this before the DROP
|
||||
* all-new at this point). It is important to do this before the DROP
|
||||
* step because if we are processing a system catalog that will be used
|
||||
* during DROP, we want to have its indexes available. There is no
|
||||
* during DROP, we want to have its indexes available. There is no
|
||||
* advantage to the other order anyway because this is all transactional,
|
||||
* so no chance to reclaim disk space before commit. We do not need a
|
||||
* final CommandCounterIncrement() because reindex_relation does it.
|
||||
|
@ -597,7 +597,7 @@ CommentRelation(int objtype, List *relname, char *comment)
|
||||
* such as a table's column. The routine will check security
|
||||
* restrictions and then attempt to look up the specified
|
||||
* attribute. If successful, a comment is added/dropped, else an
|
||||
* ereport() exception is thrown. The parameters are the relation
|
||||
* ereport() exception is thrown. The parameters are the relation
|
||||
* and attribute names, and the comment
|
||||
*/
|
||||
static void
|
||||
|
@ -49,7 +49,7 @@ unique_key_recheck(PG_FUNCTION_ARGS)
|
||||
bool isnull[INDEX_MAX_KEYS];
|
||||
|
||||
/*
|
||||
* Make sure this is being called as an AFTER ROW trigger. Note:
|
||||
* Make sure this is being called as an AFTER ROW trigger. Note:
|
||||
* translatable error strings are shared with ri_triggers.c, so resist the
|
||||
* temptation to fold the function name into them.
|
||||
*/
|
||||
@ -86,7 +86,7 @@ unique_key_recheck(PG_FUNCTION_ARGS)
|
||||
* If the new_row is now dead (ie, inserted and then deleted within our
|
||||
* transaction), we can skip the check. However, we have to be careful,
|
||||
* because this trigger gets queued only in response to index insertions;
|
||||
* which means it does not get queued for HOT updates. The row we are
|
||||
* which means it does not get queued for HOT updates. The row we are
|
||||
* called for might now be dead, but have a live HOT child, in which case
|
||||
* we still need to make the check. Therefore we have to use
|
||||
* heap_hot_search, not just HeapTupleSatisfiesVisibility as is done in
|
||||
|
@ -152,7 +152,7 @@ typedef struct CopyStateData
|
||||
|
||||
/*
|
||||
* Finally, raw_buf holds raw data read from the data source (file or
|
||||
* client connection). CopyReadLine parses this data sufficiently to
|
||||
* client connection). CopyReadLine parses this data sufficiently to
|
||||
* locate line boundaries, then transfers the data to line_buf and
|
||||
* converts it. Note: we guarantee that there is a \0 at
|
||||
* raw_buf[raw_buf_len].
|
||||
@ -179,7 +179,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.
|
||||
@ -475,7 +475,7 @@ CopySendEndOfRow(CopyState cstate)
|
||||
* CopyGetData reads data from the source (file or frontend)
|
||||
*
|
||||
* We attempt to read at least minread, and at most maxread, bytes from
|
||||
* the source. The actual number of bytes read is returned; if this is
|
||||
* the source. The actual number of bytes read is returned; if this is
|
||||
* less than minread, EOF was detected.
|
||||
*
|
||||
* Note: when copying from the frontend, we expect a proper EOF mark per
|
||||
@ -692,7 +692,7 @@ CopyLoadRawBuf(CopyState cstate)
|
||||
* we also support copying the output of an arbitrary SELECT query.
|
||||
*
|
||||
* If <pipe> is false, transfer is between the table and the file named
|
||||
* <filename>. Otherwise, transfer is between the table and our regular
|
||||
* <filename>. Otherwise, transfer is between the table and our regular
|
||||
* input/output stream. The latter could be either stdin/stdout or a
|
||||
* socket, depending on whether we're running under Postmaster control.
|
||||
*
|
||||
@ -1049,7 +1049,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString)
|
||||
errmsg("COPY (SELECT) WITH OIDS is not supported")));
|
||||
|
||||
/*
|
||||
* Run parse analysis and rewrite. Note this also acquires sufficient
|
||||
* Run parse analysis and rewrite. Note this also acquires sufficient
|
||||
* locks on the source table(s).
|
||||
*
|
||||
* Because the parser and planner tend to scribble on their input, we
|
||||
@ -1363,7 +1363,7 @@ CopyTo(CopyState cstate)
|
||||
* Create a temporary memory context that we can reset once per row to
|
||||
* recover palloc'd memory. This avoids any problems with leaks inside
|
||||
* datatype output routines, and should be faster than retail pfree's
|
||||
* anyway. (We don't need a whole econtext as CopyFrom does.)
|
||||
* anyway. (We don't need a whole econtext as CopyFrom does.)
|
||||
*/
|
||||
cstate->rowcontext = AllocSetContextCreate(CurrentMemoryContext,
|
||||
"COPY TO",
|
||||
@ -2111,7 +2111,7 @@ CopyFrom(CopyState cstate)
|
||||
|
||||
/*
|
||||
* Now compute and insert any defaults available for the columns not
|
||||
* provided by the input data. Anything not processed here or above
|
||||
* provided by the input data. Anything not processed here or above
|
||||
* will remain NULL.
|
||||
*/
|
||||
for (i = 0; i < num_defaults; i++)
|
||||
@ -2232,7 +2232,7 @@ CopyFrom(CopyState cstate)
|
||||
* server encoding.
|
||||
*
|
||||
* Result is true if read was terminated by EOF, false if terminated
|
||||
* by newline. The terminating newline or EOF marker is not included
|
||||
* by newline. The terminating newline or EOF marker is not included
|
||||
* in the final value of line_buf.
|
||||
*/
|
||||
static bool
|
||||
@ -2386,7 +2386,7 @@ CopyReadLineText(CopyState cstate)
|
||||
* of read-ahead and avoid the many calls to
|
||||
* IF_NEED_REFILL_AND_NOT_EOF_CONTINUE(), but the COPY_OLD_FE protocol
|
||||
* does not allow us to read too far ahead or we might read into the
|
||||
* next data, so we read-ahead only as far we know we can. One
|
||||
* next data, so we read-ahead only as far we know we can. One
|
||||
* optimization would be to read-ahead four byte here if
|
||||
* cstate->copy_dest != COPY_OLD_FE, but it hardly seems worth it,
|
||||
* considering the size of the buffer.
|
||||
@ -2396,7 +2396,7 @@ CopyReadLineText(CopyState cstate)
|
||||
REFILL_LINEBUF;
|
||||
|
||||
/*
|
||||
* Try to read some more data. This will certainly reset
|
||||
* Try to read some more data. This will certainly reset
|
||||
* raw_buf_index to zero, and raw_buf_ptr must go with it.
|
||||
*/
|
||||
if (!CopyLoadRawBuf(cstate))
|
||||
@ -2454,7 +2454,7 @@ CopyReadLineText(CopyState cstate)
|
||||
/*
|
||||
* Updating the line count for embedded CR and/or LF chars is
|
||||
* necessarily a little fragile - this test is probably about the
|
||||
* best we can do. (XXX it's arguable whether we should do this
|
||||
* best we can do. (XXX it's arguable whether we should do this
|
||||
* at all --- is cur_lineno a physical or logical count?)
|
||||
*/
|
||||
if (in_quote && c == (cstate->eol_type == EOL_NL ? '\n' : '\r'))
|
||||
@ -2633,7 +2633,7 @@ CopyReadLineText(CopyState cstate)
|
||||
* after a backslash is special, so we skip over that second
|
||||
* character too. If we didn't do that \\. would be
|
||||
* considered an eof-of copy, while in non-CSV mode it is a
|
||||
* literal backslash followed by a period. In CSV mode,
|
||||
* literal backslash followed by a period. In CSV mode,
|
||||
* backslashes are not special, so we want to process the
|
||||
* character after the backslash just like a normal character,
|
||||
* so we don't increment in those cases.
|
||||
@ -2705,7 +2705,7 @@ GetDecimalFromHex(char hex)
|
||||
* null_print is the null marker string. Note that this is compared to
|
||||
* the pre-de-escaped input string.
|
||||
*
|
||||
* The return value is the number of fields actually read. (We error out
|
||||
* The return value is the number of fields actually read. (We error out
|
||||
* if this would exceed maxfields, which is the length of fieldvals[].)
|
||||
*/
|
||||
static int
|
||||
@ -2735,7 +2735,7 @@ CopyReadAttributesText(CopyState cstate, int maxfields, char **fieldvals)
|
||||
/*
|
||||
* The de-escaped attributes will certainly not be longer than the input
|
||||
* data line, so we can just force attribute_buf to be large enough and
|
||||
* then transfer data without any checks for enough space. We need to do
|
||||
* then transfer data without any checks for enough space. We need to do
|
||||
* it this way because enlarging attribute_buf mid-stream would invalidate
|
||||
* pointers already stored into fieldvals[].
|
||||
*/
|
||||
@ -2963,7 +2963,7 @@ CopyReadAttributesCSV(CopyState cstate, int maxfields, char **fieldvals)
|
||||
/*
|
||||
* The de-escaped attributes will certainly not be longer than the input
|
||||
* data line, so we can just force attribute_buf to be large enough and
|
||||
* then transfer data without any checks for enough space. We need to do
|
||||
* then transfer data without any checks for enough space. We need to do
|
||||
* it this way because enlarging attribute_buf mid-stream would invalidate
|
||||
* pointers already stored into fieldvals[].
|
||||
*/
|
||||
@ -3176,7 +3176,7 @@ CopyAttributeOutText(CopyState cstate, char *string)
|
||||
/*
|
||||
* We have to grovel through the string searching for control characters
|
||||
* and instances of the delimiter character. In most cases, though, these
|
||||
* are infrequent. To avoid overhead from calling CopySendData once per
|
||||
* are infrequent. To avoid overhead from calling CopySendData once per
|
||||
* character, we dump out all characters between escaped characters in a
|
||||
* single call. The loop invariant is that the data from "start" to "ptr"
|
||||
* can be sent literally, but hasn't yet been.
|
||||
|
@ -264,7 +264,7 @@ createdb(const CreatedbStmt *stmt)
|
||||
* To create a database, must have createdb privilege and must be able to
|
||||
* become the target role (this does not imply that the target role itself
|
||||
* must have createdb privilege). The latter provision guards against
|
||||
* "giveaway" attacks. Note that a superuser will always have both of
|
||||
* "giveaway" attacks. Note that a superuser will always have both of
|
||||
* these privileges a fortiori.
|
||||
*/
|
||||
if (!have_createdb_privilege())
|
||||
@ -452,7 +452,7 @@ createdb(const CreatedbStmt *stmt)
|
||||
/*
|
||||
* If we are trying to change the default tablespace of the template,
|
||||
* we require that the template not have any files in the new default
|
||||
* tablespace. This is necessary because otherwise the copied
|
||||
* tablespace. This is necessary because otherwise the copied
|
||||
* database would contain pg_class rows that refer to its default
|
||||
* tablespace both explicitly (by OID) and implicitly (as zero), which
|
||||
* would cause problems. For example another CREATE DATABASE using
|
||||
@ -488,7 +488,7 @@ createdb(const CreatedbStmt *stmt)
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for db name conflict. This is just to give a more friendly error
|
||||
* Check for db name conflict. This is just to give a more friendly error
|
||||
* message than "unique index violation". There's a race condition but
|
||||
* we're willing to accept the less friendly message in that case.
|
||||
*/
|
||||
@ -552,7 +552,7 @@ createdb(const CreatedbStmt *stmt)
|
||||
|
||||
/*
|
||||
* We deliberately set datacl to default (NULL), rather than copying it
|
||||
* from the template database. Copying it would be a bad idea when the
|
||||
* from the template database. Copying it would be a bad idea when the
|
||||
* owner is not the same as the template's owner.
|
||||
*/
|
||||
new_record_nulls[Anum_pg_database_datacl - 1] = true;
|
||||
@ -601,7 +601,7 @@ createdb(const CreatedbStmt *stmt)
|
||||
*
|
||||
* Inconsistency of this sort is inherent to all SnapshotNow scans, unless
|
||||
* some lock is held to prevent concurrent updates of the rows being
|
||||
* sought. There should be a generic fix for that, but in the meantime
|
||||
* sought. There should be a generic fix for that, but in the meantime
|
||||
* it's worth fixing this case in particular because we are doing very
|
||||
* heavyweight operations within the scan, so that the elapsed time for
|
||||
* the scan is vastly longer than for most other catalog scans. That
|
||||
@ -1158,7 +1158,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.
|
||||
*/
|
||||
@ -1630,7 +1630,7 @@ get_db_info(const char *name, LOCKMODE lockmode,
|
||||
LockSharedObject(DatabaseRelationId, dbOid, 0, lockmode);
|
||||
|
||||
/*
|
||||
* And now, re-fetch the tuple by OID. If it's still there and still
|
||||
* And now, re-fetch the tuple by OID. If it's still there and still
|
||||
* the same name, we win; else, drop the lock and loop back to try
|
||||
* again.
|
||||
*/
|
||||
|
@ -196,7 +196,7 @@ defGetInt64(DefElem *def)
|
||||
|
||||
/*
|
||||
* Values too large for int4 will be represented as Float
|
||||
* constants by the lexer. Accept these if they are valid int8
|
||||
* constants by the lexer. Accept these if they are valid int8
|
||||
* strings.
|
||||
*/
|
||||
return DatumGetInt64(DirectFunctionCall1(int8in,
|
||||
|
@ -168,7 +168,7 @@ ExplainQuery(ExplainStmt *stmt, const char *queryString,
|
||||
* plancache.c.
|
||||
*
|
||||
* Because the rewriter and planner tend to scribble on the input, we make
|
||||
* a preliminary copy of the source querytree. This prevents problems in
|
||||
* a preliminary copy of the source querytree. This prevents problems in
|
||||
* the case that the EXPLAIN is in a portal or plpgsql function and is
|
||||
* executed repeatedly. (See also the same hack in DECLARE CURSOR and
|
||||
* PREPARE.) XXX FIXME someday.
|
||||
@ -473,7 +473,7 @@ ExplainOnePlan(PlannedStmt *plannedstmt, ExplainState *es,
|
||||
* convert a QueryDesc's plan tree to text and append it to es->str
|
||||
*
|
||||
* The caller should have set up the options fields of *es, as well as
|
||||
* initializing the output buffer es->str. Other fields in *es are
|
||||
* initializing the output buffer es->str. Other fields in *es are
|
||||
* initialized here.
|
||||
*
|
||||
* NB: will not work on utility statements
|
||||
@ -2071,7 +2071,7 @@ ExplainXMLTag(const char *tagname, int flags, ExplainState *es)
|
||||
/*
|
||||
* Emit a JSON line ending.
|
||||
*
|
||||
* JSON requires a comma after each property but the last. To facilitate this,
|
||||
* JSON requires a comma after each property but the last. To facilitate this,
|
||||
* in JSON format, the text emitted for each property begins just prior to the
|
||||
* preceding line-break (and comma, if applicable).
|
||||
*/
|
||||
@ -2092,7 +2092,7 @@ ExplainJSONLineEnding(ExplainState *es)
|
||||
* YAML lines are ordinarily indented by two spaces per indentation level.
|
||||
* The text emitted for each property begins just prior to the preceding
|
||||
* line-break, except for the first property in an unlabelled group, for which
|
||||
* it begins immediately after the "- " that introduces the group. The first
|
||||
* it begins immediately after the "- " that introduces the group. The first
|
||||
* property of the group appears on the same line as the opening "- ".
|
||||
*/
|
||||
static void
|
||||
|
@ -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
|
||||
@ -119,7 +119,7 @@ transformGenericOptions(Oid catalogId,
|
||||
|
||||
/*
|
||||
* It is possible to perform multiple SET/DROP actions on the same
|
||||
* option. The standard permits this, as long as the options to be
|
||||
* 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.
|
||||
*/
|
||||
@ -539,7 +539,7 @@ 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,
|
||||
|
@ -75,7 +75,7 @@ static void AlterFunctionOwner_internal(Relation rel, HeapTuple tup,
|
||||
* allow a shell type to be used, or even created if the specified return type
|
||||
* doesn't exist yet. (Without this, there's no way to define the I/O procs
|
||||
* for a new type.) But SQL function creation won't cope, so error out if
|
||||
* the target language is SQL. (We do this here, not in the SQL-function
|
||||
* the target language is SQL. (We do this here, not in the SQL-function
|
||||
* validator, so as not to produce a NOTICE and then an ERROR for the same
|
||||
* condition.)
|
||||
*/
|
||||
@ -422,7 +422,7 @@ examine_parameter_list(List *parameters, Oid languageOid,
|
||||
* FUNCTION and ALTER FUNCTION and return it via one of the out
|
||||
* parameters. Returns true if the passed option was recognized. If
|
||||
* the out parameter we were going to assign to points to non-NULL,
|
||||
* raise a duplicate-clause error. (We don't try to detect duplicate
|
||||
* raise a duplicate-clause error. (We don't try to detect duplicate
|
||||
* SET parameters though --- if you're redundant, the last one wins.)
|
||||
*/
|
||||
static bool
|
||||
@ -718,7 +718,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
|
||||
@ -1568,7 +1568,7 @@ CreateCast(CreateCastStmt *stmt)
|
||||
/*
|
||||
* Restricting the volatility of a cast function may or may not be a
|
||||
* good idea in the abstract, but it definitely breaks many old
|
||||
* user-defined types. Disable this check --- tgl 2/1/03
|
||||
* user-defined types. Disable this check --- tgl 2/1/03
|
||||
*/
|
||||
#ifdef NOT_USED
|
||||
if (procstruct->provolatile == PROVOLATILE_VOLATILE)
|
||||
@ -1632,7 +1632,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
|
||||
|
@ -247,7 +247,7 @@ DefineIndex(Oid relationId,
|
||||
}
|
||||
|
||||
/*
|
||||
* Force shared indexes into the pg_global tablespace. This is a bit of a
|
||||
* Force shared indexes into the pg_global tablespace. This is a bit of a
|
||||
* hack but seems simpler than marking them in the BKI commands. On the
|
||||
* other hand, if it's not shared, don't allow it to be placed there.
|
||||
*/
|
||||
@ -389,7 +389,7 @@ DefineIndex(Oid relationId,
|
||||
{
|
||||
/*
|
||||
* This shouldn't happen during CREATE TABLE, but can happen
|
||||
* during ALTER TABLE. Keep message in sync with
|
||||
* during ALTER TABLE. Keep message in sync with
|
||||
* transformIndexConstraints() in parser/parse_utilcmd.c.
|
||||
*/
|
||||
ereport(ERROR,
|
||||
@ -499,7 +499,7 @@ DefineIndex(Oid relationId,
|
||||
/*
|
||||
* For a concurrent build, it's important to make the catalog entries
|
||||
* visible to other transactions before we start to build the index. That
|
||||
* will prevent them from making incompatible HOT updates. The new index
|
||||
* will prevent them from making incompatible HOT updates. The new index
|
||||
* will be marked not indisready and not indisvalid, so that no one else
|
||||
* tries to either insert into it or use it for queries.
|
||||
*
|
||||
@ -530,8 +530,8 @@ DefineIndex(Oid relationId,
|
||||
* Now we must wait until no running transaction could have the table open
|
||||
* with the old list of indexes. To do this, inquire which xacts
|
||||
* currently would conflict with ShareLock on the table -- ie, which ones
|
||||
* have a lock that permits writing the table. Then wait for each of
|
||||
* these xacts to commit or abort. Note we do not need to worry about
|
||||
* have a lock that permits writing the table. Then wait for each of
|
||||
* these xacts to commit or abort. Note we do not need to worry about
|
||||
* xacts that open the table for writing after this point; they will see
|
||||
* the new index when they open it.
|
||||
*
|
||||
@ -542,7 +542,7 @@ DefineIndex(Oid relationId,
|
||||
* error out properly.
|
||||
*
|
||||
* Note: GetLockConflicts() never reports our own xid, hence we need not
|
||||
* check for that. Also, prepared xacts are not reported, which is fine
|
||||
* check for that. Also, prepared xacts are not reported, which is fine
|
||||
* since they certainly aren't going to do anything more.
|
||||
*/
|
||||
old_lockholders = GetLockConflicts(&heaplocktag, ShareLock);
|
||||
@ -559,7 +559,7 @@ DefineIndex(Oid relationId,
|
||||
* indexes. We have waited out all the existing transactions and any new
|
||||
* transaction will have the new index in its list, but the index is still
|
||||
* marked as "not-ready-for-inserts". The index is consulted while
|
||||
* deciding HOT-safety though. This arrangement ensures that no new HOT
|
||||
* deciding HOT-safety though. This arrangement ensures that no new HOT
|
||||
* chains can be created where the new tuple and the old tuple in the
|
||||
* chain have different index keys.
|
||||
*
|
||||
@ -625,7 +625,7 @@ DefineIndex(Oid relationId,
|
||||
|
||||
/*
|
||||
* Now take the "reference snapshot" that will be used by validate_index()
|
||||
* to filter candidate tuples. Beware! There might still be snapshots in
|
||||
* to filter candidate tuples. Beware! There might still be snapshots in
|
||||
* use that treat some transaction as in-progress that our reference
|
||||
* snapshot treats as committed. If such a recently-committed transaction
|
||||
* deleted tuples in the table, we will not include them in the index; yet
|
||||
@ -660,7 +660,7 @@ DefineIndex(Oid relationId,
|
||||
|
||||
/*
|
||||
* The index is now valid in the sense that it contains all currently
|
||||
* interesting tuples. But since it might not contain tuples deleted just
|
||||
* interesting tuples. But since it might not contain tuples deleted just
|
||||
* before the reference snap was taken, we have to wait out any
|
||||
* transactions that might have older snapshots. Obtain a list of VXIDs
|
||||
* of such transactions, and wait for them individually.
|
||||
@ -675,7 +675,7 @@ DefineIndex(Oid relationId,
|
||||
*
|
||||
* 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.)
|
||||
*
|
||||
@ -762,7 +762,7 @@ CheckMutability(Expr *expr)
|
||||
{
|
||||
/*
|
||||
* First run the expression through the planner. This has a couple of
|
||||
* important consequences. First, function default arguments will get
|
||||
* important consequences. First, function default arguments will get
|
||||
* inserted, which may affect volatility (consider "default now()").
|
||||
* Second, inline-able functions will get inlined, which may allow us to
|
||||
* conclude that the function is really less volatile than it's marked. As
|
||||
@ -785,7 +785,7 @@ CheckMutability(Expr *expr)
|
||||
* Checks that the given partial-index predicate is valid.
|
||||
*
|
||||
* This used to also constrain the form of the predicate to forms that
|
||||
* indxpath.c could do something with. However, that seems overly
|
||||
* indxpath.c could do something with. However, that seems overly
|
||||
* restrictive. One useful application of partial indexes is to apply
|
||||
* a UNIQUE constraint across a subset of a table, and in that scenario
|
||||
* any evaluatable predicate will work. So accept any predicate here
|
||||
@ -1066,7 +1066,7 @@ GetIndexOpClass(List *opclass, Oid attrType,
|
||||
* 2000/07/30
|
||||
*
|
||||
* Release 7.2 renames timestamp_ops to timestamptz_ops, so suppress that
|
||||
* too for awhile. I'm starting to think we need a better approach. tgl
|
||||
* too for awhile. I'm starting to think we need a better approach. tgl
|
||||
* 2000/10/01
|
||||
*
|
||||
* Release 8.0 removes bigbox_ops (which was dead code for a long while
|
||||
@ -1135,7 +1135,7 @@ GetIndexOpClass(List *opclass, Oid attrType,
|
||||
NameListToString(opclass), accessMethodName)));
|
||||
|
||||
/*
|
||||
* Verify that the index operator class accepts this datatype. Note we
|
||||
* Verify that the index operator class accepts this datatype. Note we
|
||||
* will accept binary compatibility.
|
||||
*/
|
||||
opClassId = HeapTupleGetOid(tuple);
|
||||
@ -1156,7 +1156,7 @@ GetIndexOpClass(List *opclass, Oid attrType,
|
||||
* GetDefaultOpClass
|
||||
*
|
||||
* Given the OIDs of a datatype and an access method, find the default
|
||||
* operator class, if any. Returns InvalidOid if there is none.
|
||||
* operator class, if any. Returns InvalidOid if there is none.
|
||||
*/
|
||||
Oid
|
||||
GetDefaultOpClass(Oid type_id, Oid am_id)
|
||||
@ -1251,7 +1251,7 @@ GetDefaultOpClass(Oid type_id, Oid am_id)
|
||||
* Create a name for an implicitly created index, sequence, constraint, etc.
|
||||
*
|
||||
* The parameters are typically: the original table name, the original field
|
||||
* name, and a "type" string (such as "seq" or "pkey"). The field name
|
||||
* name, and a "type" string (such as "seq" or "pkey"). The field name
|
||||
* and/or type can be NULL if not relevant.
|
||||
*
|
||||
* The result is a palloc'd string.
|
||||
@ -1259,7 +1259,7 @@ GetDefaultOpClass(Oid type_id, Oid am_id)
|
||||
* The basic result we want is "name1_name2_label", omitting "_name2" or
|
||||
* "_label" when those parameters are NULL. However, we must generate
|
||||
* a name with less than NAMEDATALEN characters! So, we truncate one or
|
||||
* both names if necessary to make a short-enough string. The label part
|
||||
* both names if necessary to make a short-enough string. The label part
|
||||
* is never truncated (so it had better be reasonably short).
|
||||
*
|
||||
* The caller is responsible for checking uniqueness of the generated
|
||||
@ -1454,7 +1454,7 @@ ChooseIndexNameAddition(List *colnames)
|
||||
|
||||
/*
|
||||
* Select the actual names to be used for the columns of an index, given the
|
||||
* list of IndexElems for the columns. This is mostly about ensuring the
|
||||
* list of IndexElems for the columns. This is mostly about ensuring the
|
||||
* names are unique so we don't get a conflicting-attribute-names error.
|
||||
*
|
||||
* Returns a List of plain strings (char *, not String nodes).
|
||||
|
@ -302,7 +302,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
|
||||
* A minimum expectation therefore is that the caller have execute
|
||||
* privilege with grant option. Since we don't have a way to make the
|
||||
* opclass go away if the grant option is revoked, we choose instead to
|
||||
* require ownership of the functions. It's also not entirely clear what
|
||||
* require ownership of the functions. It's also not entirely clear what
|
||||
* permissions should be required on the datatype, but ownership seems
|
||||
* like a safe choice.
|
||||
*
|
||||
@ -589,7 +589,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
|
||||
opclassoid, procedures, false);
|
||||
|
||||
/*
|
||||
* Create dependencies for the opclass proper. Note: we do not create a
|
||||
* Create dependencies for the opclass proper. Note: we do not create a
|
||||
* dependency link to the AM, because we don't currently support DROP
|
||||
* ACCESS METHOD.
|
||||
*/
|
||||
@ -2113,7 +2113,7 @@ AlterOpFamilyOwner_oid(Oid opfamilyOid, Oid newOwnerId)
|
||||
}
|
||||
|
||||
/*
|
||||
* The first parameter is pg_opfamily, opened and suitably locked. The second
|
||||
* The first parameter is pg_opfamily, opened and suitably locked. The second
|
||||
* parameter is a copy of the tuple from pg_opfamily we want to modify.
|
||||
*/
|
||||
static void
|
||||
|
@ -198,7 +198,7 @@ DefineOperator(List *names, List *parameters)
|
||||
functionOid = LookupFuncName(functionName, nargs, typeId, false);
|
||||
|
||||
/*
|
||||
* We require EXECUTE rights for the function. This isn't strictly
|
||||
* 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.
|
||||
*/
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Utility commands affecting portals (that is, SQL cursor commands)
|
||||
*
|
||||
* Note: see also tcop/pquery.c, which implements portal operations for
|
||||
* the FE/BE protocol. This module uses pquery.c for some operations.
|
||||
* the FE/BE protocol. This module uses pquery.c for some operations.
|
||||
* And both modules depend on utils/mmgr/portalmem.c, which controls
|
||||
* storage management for portals (but doesn't run any queries in them).
|
||||
*
|
||||
@ -89,7 +89,7 @@ PerformCursorOpen(PlannedStmt *stmt, ParamListInfo params,
|
||||
|
||||
/*----------
|
||||
* Also copy the outer portal's parameter list into the inner portal's
|
||||
* memory context. We want to pass down the parameter values in case we
|
||||
* memory context. We want to pass down the parameter values in case we
|
||||
* had a command like
|
||||
* DECLARE c CURSOR FOR SELECT ... WHERE foo = $1
|
||||
* This will have been parsed using the outer parameter set and the
|
||||
@ -106,7 +106,7 @@ PerformCursorOpen(PlannedStmt *stmt, ParamListInfo params,
|
||||
*
|
||||
* If the user didn't specify a SCROLL type, allow or disallow scrolling
|
||||
* based on whether it would require any additional runtime overhead to do
|
||||
* so. Also, we disallow scrolling for FOR UPDATE cursors.
|
||||
* so. Also, we disallow scrolling for FOR UPDATE cursors.
|
||||
*/
|
||||
portal->cursorOptions = cstmt->options;
|
||||
if (!(portal->cursorOptions & (CURSOR_OPT_SCROLL | CURSOR_OPT_NO_SCROLL)))
|
||||
@ -354,7 +354,7 @@ PersistHoldablePortal(Portal portal)
|
||||
ExecutorRewind(queryDesc);
|
||||
|
||||
/*
|
||||
* Change the destination to output to the tuplestore. Note we tell
|
||||
* 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);
|
||||
|
@ -432,7 +432,7 @@ InitQueryHashTable(void)
|
||||
* copy.
|
||||
*
|
||||
* Exception: commandTag is presumed to be a pointer to a constant string,
|
||||
* or possibly NULL, so it need not be copied. Note that commandTag should
|
||||
* or possibly NULL, so it need not be copied. Note that commandTag should
|
||||
* be NULL only if the original query (before rewriting) was empty.
|
||||
*/
|
||||
void
|
||||
@ -546,7 +546,7 @@ FetchPreparedStatementResultDesc(PreparedStatement *stmt)
|
||||
|
||||
/*
|
||||
* Given a prepared statement that returns tuples, extract the query
|
||||
* targetlist. Returns NIL if the statement doesn't have a determinable
|
||||
* targetlist. Returns NIL if the statement doesn't have a determinable
|
||||
* targetlist.
|
||||
*
|
||||
* Note: this is pretty ugly, but since it's only used in corner cases like
|
||||
|
@ -260,7 +260,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
|
||||
if (funcrettype != LANGUAGE_HANDLEROID)
|
||||
{
|
||||
/*
|
||||
* We allow OPAQUE just so we can load old dump files. When we
|
||||
* We allow OPAQUE just so we can load old dump files. When we
|
||||
* see a handler function declared OPAQUE, change it to
|
||||
* LANGUAGE_HANDLER. (This is probably obsolete and removable?)
|
||||
*/
|
||||
|
@ -65,7 +65,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString)
|
||||
* To create a schema, must have schema-create privilege on the current
|
||||
* database and must be able to become the target role (this does not
|
||||
* imply that the target role itself must have create-schema privilege).
|
||||
* The latter provision guards against "giveaway" attacks. Note that a
|
||||
* The latter provision guards against "giveaway" attacks. Note that a
|
||||
* superuser will always have both of these privileges a fortiori.
|
||||
*/
|
||||
aclresult = pg_database_aclcheck(MyDatabaseId, saved_uid, ACL_CREATE);
|
||||
@ -113,7 +113,7 @@ CreateSchemaCommand(CreateSchemaStmt *stmt, const char *queryString)
|
||||
/*
|
||||
* Examine the list of commands embedded in the CREATE SCHEMA command, and
|
||||
* reorganize them into a sequentially executable order with no forward
|
||||
* references. Note that the result is still a list of raw parsetrees ---
|
||||
* references. Note that the result is still a list of raw parsetrees ---
|
||||
* we cannot, in general, run parse analysis on one statement until we
|
||||
* have actually executed the prior ones.
|
||||
*/
|
||||
|
@ -60,7 +60,7 @@ typedef struct sequence_magic
|
||||
* rely on the relcache, since it's only, well, a cache, and may decide to
|
||||
* discard entries.)
|
||||
*
|
||||
* XXX We use linear search to find pre-existing SeqTable entries. This is
|
||||
* XXX We use linear search to find pre-existing SeqTable entries. This is
|
||||
* good when only a small number of sequences are touched in a session, but
|
||||
* would suck with many different sequences. Perhaps use a hashtable someday.
|
||||
*/
|
||||
@ -234,8 +234,8 @@ DefineSequence(CreateSeqStmt *seq)
|
||||
* Two special hacks here:
|
||||
*
|
||||
* 1. Since VACUUM does not process sequences, we have to force the tuple
|
||||
* to have xmin = FrozenTransactionId now. Otherwise it would become
|
||||
* invisible to SELECTs after 2G transactions. It is okay to do this
|
||||
* to have xmin = FrozenTransactionId now. Otherwise it would become
|
||||
* invisible to SELECTs after 2G transactions. It is okay to do this
|
||||
* because if the current transaction aborts, no other xact will ever
|
||||
* examine the sequence tuple anyway.
|
||||
*
|
||||
@ -496,7 +496,7 @@ nextval_internal(Oid relid)
|
||||
}
|
||||
|
||||
/*
|
||||
* Decide whether we should emit a WAL log record. If so, force up the
|
||||
* Decide whether we should emit a WAL log record. If so, force up the
|
||||
* fetch count to grab SEQ_LOG_VALS more values than we actually need to
|
||||
* cache. (These will then be usable without logging.)
|
||||
*
|
||||
@ -867,7 +867,7 @@ setval3_oid(PG_FUNCTION_ARGS)
|
||||
* Open the sequence and acquire AccessShareLock if needed
|
||||
*
|
||||
* If we haven't touched the sequence already in this transaction,
|
||||
* we need to acquire AccessShareLock. We arrange for the lock to
|
||||
* we need to acquire AccessShareLock. We arrange for the lock to
|
||||
* be owned by the top transaction, so that we don't need to do it
|
||||
* more than once per xact.
|
||||
*/
|
||||
|
@ -485,7 +485,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId)
|
||||
&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.
|
||||
*/
|
||||
@ -578,7 +578,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId)
|
||||
CommandCounterIncrement();
|
||||
|
||||
/*
|
||||
* Open the new relation and acquire exclusive lock on it. This isn't
|
||||
* Open the new relation and acquire exclusive lock on it. This isn't
|
||||
* really necessary for locking out other backends (since they can't see
|
||||
* the new rel anyway until we commit), but it keeps the lock manager from
|
||||
* complaining about deadlock risks.
|
||||
@ -867,10 +867,10 @@ ExecuteTruncate(TruncateStmt *stmt)
|
||||
}
|
||||
|
||||
/*
|
||||
* In CASCADE mode, suck in all referencing relations as well. This
|
||||
* In CASCADE mode, suck in all referencing relations as well. This
|
||||
* requires multiple iterations to find indirectly-dependent relations. At
|
||||
* each phase, we need to exclusive-lock new rels before looking for their
|
||||
* dependencies, else we might miss something. Also, we check each rel as
|
||||
* dependencies, else we might miss something. Also, we check each rel as
|
||||
* soon as we open it, to avoid a faux pas such as holding lock for a long
|
||||
* time on a rel we have no permissions for.
|
||||
*/
|
||||
@ -1087,7 +1087,7 @@ ExecuteTruncate(TruncateStmt *stmt)
|
||||
}
|
||||
|
||||
/*
|
||||
* Check that a given rel is safe to truncate. Subroutine for ExecuteTruncate
|
||||
* Check that a given rel is safe to truncate. Subroutine for ExecuteTruncate
|
||||
*/
|
||||
static void
|
||||
truncate_check_rel(Relation rel)
|
||||
@ -1483,7 +1483,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)
|
||||
@ -1538,7 +1538,7 @@ MergeAttributes(List *schema, List *supers, bool istemp,
|
||||
|
||||
/*
|
||||
* Close the parent rel, but keep our AccessShareLock on it until xact
|
||||
* commit. That will prevent someone else from deleting or ALTERing
|
||||
* commit. That will prevent someone else from deleting or ALTERing
|
||||
* the parent before the child is committed.
|
||||
*/
|
||||
heap_close(relation, NoLock);
|
||||
@ -1992,7 +1992,7 @@ renameatt(Oid myrelid,
|
||||
oldattname)));
|
||||
|
||||
/*
|
||||
* if the attribute is inherited, forbid the renaming. if this is a
|
||||
* if the attribute is inherited, forbid the renaming. if this is a
|
||||
* top-level call to renameatt(), then expected_parents will be 0, so the
|
||||
* effect of this code will be to prohibit the renaming if the attribute
|
||||
* is inherited at all. if this is a recursive call to renameatt(),
|
||||
@ -2130,7 +2130,7 @@ RenameRelationInternal(Oid myrelid, const char *newrelname, Oid namespaceId)
|
||||
newrelname)));
|
||||
|
||||
/*
|
||||
* Update pg_class tuple with new relname. (Scribbling on reltup is OK
|
||||
* Update pg_class tuple with new relname. (Scribbling on reltup is OK
|
||||
* because it's a copy...)
|
||||
*/
|
||||
namestrcpy(&(relform->relname), newrelname);
|
||||
@ -2183,7 +2183,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
|
||||
@ -2226,23 +2226,23 @@ CheckTableNotInUse(Relation rel, const char *stmt)
|
||||
* 3. Scan table(s) to check new constraints, and optionally recopy
|
||||
* the data into new table(s).
|
||||
* Phase 3 is not performed unless one or more of the subcommands requires
|
||||
* it. The intention of this design is to allow multiple independent
|
||||
* it. The intention of this design is to allow multiple independent
|
||||
* updates of the table schema to be performed with only one pass over the
|
||||
* data.
|
||||
*
|
||||
* ATPrepCmd performs phase 1. A "work queue" entry is created for
|
||||
* ATPrepCmd performs phase 1. A "work queue" entry is created for
|
||||
* each table to be affected (there may be multiple affected tables if the
|
||||
* commands traverse a table inheritance hierarchy). Also we do preliminary
|
||||
* validation of the subcommands, including parse transformation of those
|
||||
* 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
|
||||
* unnecessary conflicts; for example, DROP COLUMN should come before
|
||||
* ADD COLUMN. Therefore phase 1 divides the subcommands into multiple
|
||||
* ADD COLUMN. Therefore phase 1 divides the subcommands into multiple
|
||||
* lists, one for each logical "pass" of phase 2.
|
||||
*
|
||||
* ATRewriteTables performs phase 3 for those tables that need it.
|
||||
@ -2552,7 +2552,7 @@ ATPrepCmd(List **wqueue, Relation rel, AlterTableCmd *cmd,
|
||||
/*
|
||||
* ATRewriteCatalogs
|
||||
*
|
||||
* Traffic cop for ALTER TABLE Phase 2 operations. Subcommands are
|
||||
* Traffic cop for ALTER TABLE Phase 2 operations. Subcommands are
|
||||
* dispatched in a "safe" execution order (designed to avoid unnecessary
|
||||
* conflicts).
|
||||
*/
|
||||
@ -3747,7 +3747,7 @@ 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.
|
||||
@ -3830,7 +3830,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
|
||||
@ -4270,7 +4270,7 @@ ATExecSetStorage(Relation rel, const char *colName, Node *newValue)
|
||||
*
|
||||
* DROP COLUMN cannot use the normal ALTER TABLE recursion mechanism,
|
||||
* because we have to decide at runtime whether to recurse or not depending
|
||||
* on whether attinhcount goes to zero or not. (We can't check this in a
|
||||
* on whether attinhcount goes to zero or not. (We can't check this in a
|
||||
* static pre-pass because it won't handle multiple inheritance situations
|
||||
* correctly.)
|
||||
*/
|
||||
@ -4711,7 +4711,7 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
|
||||
/*
|
||||
* Add a foreign-key constraint to a single table
|
||||
*
|
||||
* Subroutine for ATExecAddConstraint. Must already hold exclusive
|
||||
* Subroutine for ATExecAddConstraint. Must already hold exclusive
|
||||
* lock on the rel, and have done appropriate validity checks for it.
|
||||
* We do permissions checks here, however.
|
||||
*/
|
||||
@ -4836,7 +4836,7 @@ ATAddForeignKeyConstraint(AlteredTableInfo *tab, Relation rel,
|
||||
*
|
||||
* Note that we have to be careful about the difference between the actual
|
||||
* PK column type and the opclass' declared input type, which might be
|
||||
* only binary-compatible with it. The declared opcintype is the right
|
||||
* only binary-compatible with it. The declared opcintype is the right
|
||||
* thing to probe pg_amop with.
|
||||
*/
|
||||
if (numfks != numpks)
|
||||
@ -5050,10 +5050,10 @@ transformColumnNameList(Oid relId, List *colList,
|
||||
* transformFkeyGetPrimaryKey -
|
||||
*
|
||||
* Look up the names, attnums, and types of the primary key attributes
|
||||
* for the pkrel. Also return the index OID and index opclasses of the
|
||||
* for the pkrel. Also return the index OID and index opclasses of the
|
||||
* index supporting the primary key.
|
||||
*
|
||||
* All parameters except pkrel are output parameters. Also, the function
|
||||
* All parameters except pkrel are output parameters. Also, the function
|
||||
* return value is the number of attributes in the primary key.
|
||||
*
|
||||
* Used when the column list in the REFERENCES specification is omitted.
|
||||
@ -5093,7 +5093,7 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
|
||||
if (indexStruct->indisprimary && IndexIsValid(indexStruct))
|
||||
{
|
||||
/*
|
||||
* Refuse to use a deferrable primary key. This is per SQL spec,
|
||||
* Refuse to use a deferrable primary key. This is per SQL spec,
|
||||
* and there would be a lot of interesting semantic problems if we
|
||||
* tried to allow it.
|
||||
*/
|
||||
@ -5900,7 +5900,7 @@ ATPrepAlterColumnType(List **wqueue,
|
||||
ReleaseSysCache(tuple);
|
||||
|
||||
/*
|
||||
* The recursion case is handled by ATSimpleRecursion. However, if we are
|
||||
* The recursion case is handled by ATSimpleRecursion. However, if we are
|
||||
* told not to recurse, there had better not be any child tables; else the
|
||||
* alter would put them out of step.
|
||||
*/
|
||||
@ -5965,7 +5965,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
|
||||
*
|
||||
* We remove any implicit coercion steps at the top level of the old
|
||||
* default expression; this has been agreed to satisfy the principle of
|
||||
* least surprise. (The conversion to the new column type should act like
|
||||
* least surprise. (The conversion to the new column type should act like
|
||||
* it started from what the user sees as the stored expression, and the
|
||||
* implicit coercions aren't going to be shown.)
|
||||
*/
|
||||
@ -5994,7 +5994,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
|
||||
* and record enough information to let us recreate the objects.
|
||||
*
|
||||
* The actual recreation does not happen here, but only after we have
|
||||
* performed all the individual ALTER TYPE operations. We have to save
|
||||
* performed all the individual ALTER TYPE operations. We have to save
|
||||
* the info before executing ALTER TYPE, though, else the deparser will
|
||||
* get confused.
|
||||
*
|
||||
@ -6222,7 +6222,7 @@ ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel,
|
||||
heap_close(depRel, RowExclusiveLock);
|
||||
|
||||
/*
|
||||
* Here we go --- change the recorded column type. (Note heapTup is a
|
||||
* Here we go --- change the recorded column type. (Note heapTup is a
|
||||
* copy of the syscache entry, so okay to scribble on.)
|
||||
*/
|
||||
attTup->atttypid = targettype;
|
||||
@ -6289,7 +6289,7 @@ ATPostAlterTypeCleanup(List **wqueue, AlteredTableInfo *tab)
|
||||
|
||||
/*
|
||||
* Re-parse the index and constraint definitions, and attach them to the
|
||||
* appropriate work queue entries. We do this before dropping because in
|
||||
* appropriate work queue entries. We do this before dropping because in
|
||||
* the case of a FOREIGN KEY constraint, we might not yet have exclusive
|
||||
* lock on the table the constraint is attached to, and we need to get
|
||||
* that before dropping. It's safe because the parser won't actually look
|
||||
@ -7204,7 +7204,7 @@ copy_relation_data(SMgrRelation src, SMgrRelation dst,
|
||||
log_newpage(&dst->smgr_rnode, forkNum, blkno, page);
|
||||
|
||||
/*
|
||||
* Now write the page. We say isTemp = true even if it's not a temp
|
||||
* Now write the page. We say isTemp = true even if it's not a temp
|
||||
* rel, because there's no need for smgr to schedule an fsync for this
|
||||
* write; we'll do it ourselves below.
|
||||
*/
|
||||
@ -7373,7 +7373,7 @@ ATExecAddInherit(Relation child_rel, RangeVar *parent)
|
||||
MergeConstraintsIntoExisting(child_rel, parent_rel);
|
||||
|
||||
/*
|
||||
* OK, it looks valid. Make the catalog entries that show inheritance.
|
||||
* OK, it looks valid. Make the catalog entries that show inheritance.
|
||||
*/
|
||||
StoreCatalogInheritance1(RelationGetRelid(child_rel),
|
||||
RelationGetRelid(parent_rel),
|
||||
@ -8304,7 +8304,7 @@ AtEOXact_on_commit_actions(bool isCommit)
|
||||
* Post-subcommit or post-subabort cleanup for ON COMMIT management.
|
||||
*
|
||||
* During subabort, we can immediately remove entries created during this
|
||||
* subtransaction. During subcommit, just relabel entries marked during
|
||||
* subtransaction. During subcommit, just relabel entries marked during
|
||||
* this subtransaction as being the parent's responsibility.
|
||||
*/
|
||||
void
|
||||
|
@ -31,7 +31,7 @@
|
||||
* To allow CREATE DATABASE to give a new database a default tablespace
|
||||
* that's different from the template database's default, we make the
|
||||
* provision that a zero in pg_class.reltablespace means the database's
|
||||
* default tablespace. Without this, CREATE DATABASE would have to go in
|
||||
* default tablespace. Without this, CREATE DATABASE would have to go in
|
||||
* and munge the system catalogs of the new database.
|
||||
*
|
||||
*
|
||||
@ -272,7 +272,7 @@ CreateTableSpace(CreateTableSpaceStmt *stmt)
|
||||
|
||||
/*
|
||||
* Check that location isn't too long. Remember that we're going to append
|
||||
* 'PG_XXX/<dboid>/<relid>.<nnn>'. FYI, we never actually reference the
|
||||
* 'PG_XXX/<dboid>/<relid>.<nnn>'. FYI, we never actually reference the
|
||||
* whole path, but mkdir() uses the first two parts.
|
||||
*/
|
||||
if (strlen(location) + 1 + strlen(TABLESPACE_VERSION_DIRECTORY) + 1 +
|
||||
@ -467,7 +467,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
|
||||
* Not all files deleted? However, there can be lingering empty files
|
||||
* in the directories, left behind by for example DROP TABLE, that
|
||||
* have been scheduled for deletion at next checkpoint (see comments
|
||||
* in mdunlink() for details). We could just delete them immediately,
|
||||
* in mdunlink() for details). We could just delete them immediately,
|
||||
* but we can't tell them apart from important data files that we
|
||||
* mustn't delete. So instead, we force a checkpoint which will clean
|
||||
* out any lingering files, and try again.
|
||||
@ -545,7 +545,7 @@ create_tablespace_directories(const char *location, const Oid tablespaceoid)
|
||||
TABLESPACE_VERSION_DIRECTORY);
|
||||
|
||||
/*
|
||||
* Attempt to coerce target directory to safe permissions. If this fails,
|
||||
* Attempt to coerce target directory to safe permissions. If this fails,
|
||||
* it doesn't exist or has the wrong owner.
|
||||
*/
|
||||
if (chmod(location, 0700) != 0)
|
||||
@ -683,7 +683,7 @@ destroy_tablespace_directories(Oid tablespaceoid, bool redo)
|
||||
*
|
||||
* If redo is true then ENOENT is a likely outcome here, and we allow it
|
||||
* to pass without comment. In normal operation we still allow it, but
|
||||
* with a warning. This is because even though ProcessUtility disallows
|
||||
* with a warning. This is because even though ProcessUtility disallows
|
||||
* DROP TABLESPACE in a transaction block, it's possible that a previous
|
||||
* DROP failed and rolled back after removing the tablespace directories
|
||||
* and/or symlink. We want to allow a new DROP attempt to succeed at
|
||||
@ -1069,7 +1069,7 @@ assign_default_tablespace(const char *newval, bool doit, GucSource source)
|
||||
{
|
||||
/*
|
||||
* If we aren't inside a transaction, we cannot do database access so
|
||||
* cannot verify the name. Must accept the value on faith.
|
||||
* cannot verify the name. Must accept the value on faith.
|
||||
*/
|
||||
if (IsTransactionState())
|
||||
{
|
||||
@ -1172,7 +1172,7 @@ assign_temp_tablespaces(const char *newval, bool doit, GucSource source)
|
||||
|
||||
/*
|
||||
* If we aren't inside a transaction, we cannot do database access so
|
||||
* cannot verify the individual names. Must accept the list on faith.
|
||||
* cannot verify the individual names. Must accept the list on faith.
|
||||
* Fortunately, there's then also no need to pass the data to fd.c.
|
||||
*/
|
||||
if (IsTransactionState())
|
||||
|
@ -99,7 +99,7 @@ static void AfterTriggerSaveEvent(EState *estate, ResultRelInfo *relinfo,
|
||||
*
|
||||
* constraintOid, if nonzero, says that this trigger is being created
|
||||
* internally to implement that constraint. A suitable pg_depend entry will
|
||||
* be made to link the trigger to that constraint. constraintOid is zero when
|
||||
* be made to link the trigger to that constraint. constraintOid is zero when
|
||||
* executing a user-entered CREATE TRIGGER command. (For CREATE CONSTRAINT
|
||||
* TRIGGER, we build a pg_constraint entry internally.)
|
||||
*
|
||||
@ -335,7 +335,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
|
||||
if (funcrettype != TRIGGEROID)
|
||||
{
|
||||
/*
|
||||
* We allow OPAQUE just so we can load old dump files. When we see a
|
||||
* We allow OPAQUE just so we can load old dump files. When we see a
|
||||
* trigger function declared OPAQUE, change it to TRIGGER.
|
||||
*/
|
||||
if (funcrettype == OPAQUEOID)
|
||||
@ -357,7 +357,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
|
||||
* references one of the built-in RI_FKey trigger functions, assume it is
|
||||
* from a dump of a pre-7.3 foreign key constraint, and take steps to
|
||||
* convert this legacy representation into a regular foreign key
|
||||
* constraint. Ugly, but necessary for loading old dump files.
|
||||
* constraint. Ugly, but necessary for loading old dump files.
|
||||
*/
|
||||
if (stmt->isconstraint && !isInternal &&
|
||||
list_length(stmt->args) >= 6 &&
|
||||
@ -417,7 +417,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
|
||||
|
||||
/*
|
||||
* If trigger is internally generated, modify the provided trigger name to
|
||||
* ensure uniqueness by appending the trigger OID. (Callers will usually
|
||||
* ensure uniqueness by appending the trigger OID. (Callers will usually
|
||||
* supply a simple constant trigger name in these cases.)
|
||||
*/
|
||||
if (isInternal)
|
||||
@ -541,7 +541,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
|
||||
int2 attnum;
|
||||
int j;
|
||||
|
||||
/* Lookup column name. System columns are not allowed */
|
||||
/* Lookup column name. System columns are not allowed */
|
||||
attnum = attnameAttNum(rel, name, false);
|
||||
if (attnum == InvalidAttrNumber)
|
||||
ereport(ERROR,
|
||||
@ -646,7 +646,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
|
||||
else
|
||||
{
|
||||
/*
|
||||
* User CREATE TRIGGER, so place dependencies. We make trigger be
|
||||
* User CREATE TRIGGER, so place dependencies. We make trigger be
|
||||
* auto-dropped if its relation is dropped or if the FK relation is
|
||||
* dropped. (Auto drop is compatible with our pre-7.3 behavior.)
|
||||
*/
|
||||
@ -711,7 +711,7 @@ CreateTrigger(CreateTrigStmt *stmt, const char *queryString,
|
||||
* full-fledged foreign key constraints.
|
||||
*
|
||||
* The conversion is complex because a pre-7.3 foreign key involved three
|
||||
* separate triggers, which were reported separately in dumps. While the
|
||||
* separate triggers, which were reported separately in dumps. While the
|
||||
* single trigger on the referencing table adds no new information, we need
|
||||
* to know the trigger functions of both of the triggers on the referenced
|
||||
* table to build the constraint declaration. Also, due to lack of proper
|
||||
@ -2685,7 +2685,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".
|
||||
*
|
||||
@ -2699,7 +2699,7 @@ 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;
|
||||
@ -2746,7 +2746,7 @@ 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.
|
||||
*/
|
||||
@ -2788,7 +2788,7 @@ typedef struct AfterTriggerEventList
|
||||
*
|
||||
* firing_counter is incremented for each call of afterTriggerInvokeEvents.
|
||||
* We mark firable events with the current firing cycle's ID so that we can
|
||||
* tell which ones to work on. This ensures sane behavior if a trigger
|
||||
* tell which ones to work on. This ensures sane behavior if a trigger
|
||||
* function chooses to do SET CONSTRAINTS: the inner SET CONSTRAINTS will
|
||||
* only fire those events that weren't already scheduled for firing.
|
||||
*
|
||||
@ -2796,7 +2796,7 @@ typedef struct AfterTriggerEventList
|
||||
* This is saved and restored across failed subtransactions.
|
||||
*
|
||||
* events is the current list of deferred events. This is global across
|
||||
* all subtransactions of the current transaction. In a subtransaction
|
||||
* all subtransactions of the current transaction. In a subtransaction
|
||||
* abort, we know that the events added by the subtransaction are at the
|
||||
* end of the list, so it is relatively easy to discard them. The event
|
||||
* list chunks themselves are stored in event_cxt.
|
||||
@ -2824,12 +2824,12 @@ typedef struct AfterTriggerEventList
|
||||
* which we similarly use to clean up at subtransaction abort.
|
||||
*
|
||||
* firing_stack is a stack of copies of subtransaction-start-time
|
||||
* firing_counter. We use this to recognize which deferred triggers were
|
||||
* firing_counter. We use this to recognize which deferred triggers were
|
||||
* fired (or marked for firing) within an aborted subtransaction.
|
||||
*
|
||||
* We use GetCurrentTransactionNestLevel() to determine the correct array
|
||||
* index in these stacks. maxtransdepth is the number of allocated entries in
|
||||
* each stack. (By not keeping our own stack pointer, we can avoid trouble
|
||||
* each stack. (By not keeping our own stack pointer, we can avoid trouble
|
||||
* in cases where errors during subxact abort cause multiple invocations
|
||||
* of AfterTriggerEndSubXact() at the same nesting depth.)
|
||||
*/
|
||||
@ -3097,7 +3097,7 @@ afterTriggerRestoreEventList(AfterTriggerEventList *events,
|
||||
* single trigger function.
|
||||
*
|
||||
* Frequently, this will be fired many times in a row for triggers of
|
||||
* a single relation. Therefore, we cache the open relation and provide
|
||||
* a single relation. Therefore, we cache the open relation and provide
|
||||
* fmgr lookup cache space at the caller level. (For triggers fired at
|
||||
* the end of a query, we can even piggyback on the executor's state.)
|
||||
*
|
||||
@ -3614,7 +3614,7 @@ AfterTriggerFireDeferred(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Run all the remaining triggers. Loop until they are all gone, in case
|
||||
* Run all the remaining triggers. Loop until they are all gone, in case
|
||||
* some trigger queues more for us to do.
|
||||
*/
|
||||
while (afterTriggerMarkEvents(events, NULL, false))
|
||||
@ -3677,7 +3677,7 @@ AfterTriggerBeginSubXact(void)
|
||||
int my_level = GetCurrentTransactionNestLevel();
|
||||
|
||||
/*
|
||||
* Ignore call if the transaction is in aborted state. (Probably
|
||||
* Ignore call if the transaction is in aborted state. (Probably
|
||||
* shouldn't happen?)
|
||||
*/
|
||||
if (afterTriggers == NULL)
|
||||
@ -3756,7 +3756,7 @@ AfterTriggerEndSubXact(bool isCommit)
|
||||
CommandId subxact_firing_id;
|
||||
|
||||
/*
|
||||
* Ignore call if the transaction is in aborted state. (Probably
|
||||
* Ignore call if the transaction is in aborted state. (Probably
|
||||
* unneeded)
|
||||
*/
|
||||
if (afterTriggers == NULL)
|
||||
@ -3888,7 +3888,7 @@ SetConstraintStateCopy(SetConstraintState origstate)
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a per-trigger item to a SetConstraintState. Returns possibly-changed
|
||||
* Add a per-trigger item to a SetConstraintState. Returns possibly-changed
|
||||
* pointer to the state object (it will change if we have to repalloc).
|
||||
*/
|
||||
static SetConstraintState
|
||||
@ -3973,7 +3973,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
|
||||
* First, identify all the named constraints and make a list of their
|
||||
* OIDs. Since, unlike the SQL spec, we allow multiple constraints of
|
||||
* the same name within a schema, the specifications are not
|
||||
* necessarily unique. Our strategy is to target all matching
|
||||
* necessarily unique. Our strategy is to target all matching
|
||||
* constraints within the first search-path schema that has any
|
||||
* matches, but disregard matches in schemas beyond the first match.
|
||||
* (This is a bit odd but it's the historical behavior.)
|
||||
@ -3999,7 +3999,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
|
||||
|
||||
/*
|
||||
* If we're given the schema name with the constraint, look only
|
||||
* in that schema. If given a bare constraint name, use the
|
||||
* in that schema. If given a bare constraint name, use the
|
||||
* search path to find the first matching constraint.
|
||||
*/
|
||||
if (constraint->schemaname)
|
||||
@ -4102,7 +4102,7 @@ AfterTriggerSetState(ConstraintsSetStmt *stmt)
|
||||
|
||||
/*
|
||||
* Silently skip triggers that are marked as non-deferrable in
|
||||
* pg_trigger. This is not an error condition, since a
|
||||
* pg_trigger. This is not an error condition, since a
|
||||
* deferrable RI constraint may have some non-deferrable
|
||||
* actions.
|
||||
*/
|
||||
@ -4173,7 +4173,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
|
||||
@ -4233,7 +4233,7 @@ AfterTriggerPendingOnRel(Oid relid)
|
||||
AfterTriggerShared evtshared = GetTriggerSharedData(event);
|
||||
|
||||
/*
|
||||
* We can ignore completed events. (Even if a DONE flag is rolled
|
||||
* We can ignore completed events. (Even if a DONE flag is rolled
|
||||
* back by subxact abort, it's OK because the effects of the TRUNCATE
|
||||
* or whatever must get rolled back too.)
|
||||
*/
|
||||
@ -4274,7 +4274,7 @@ AfterTriggerPendingOnRel(Oid relid)
|
||||
* be fired for an event.
|
||||
*
|
||||
* NOTE: this is called whenever there are any triggers associated with
|
||||
* the event (even if they are disabled). This function decides which
|
||||
* the event (even if they are disabled). This function decides which
|
||||
* triggers actually need to be queued.
|
||||
* ----------
|
||||
*/
|
||||
|
@ -489,8 +489,8 @@ DefineType(List *names, List *parameters)
|
||||
analyzeOid = findTypeAnalyzeFunction(analyzeName, typoid);
|
||||
|
||||
/*
|
||||
* Check permissions on functions. We choose to require the creator/owner
|
||||
* of a type to also own the underlying functions. Since creating a type
|
||||
* Check permissions on functions. We choose to require the creator/owner
|
||||
* of a type to also own the underlying functions. Since creating a type
|
||||
* is tantamount to granting public execute access on the functions, the
|
||||
* minimum sane check would be for execute-with-grant-option. But we
|
||||
* don't have a way to make the type go away if the grant option is
|
||||
@ -781,7 +781,7 @@ DefineDomain(CreateDomainStmt *stmt)
|
||||
get_namespace_name(domainNamespace));
|
||||
|
||||
/*
|
||||
* Check for collision with an existing type name. If there is one and
|
||||
* Check for collision with an existing type name. If there is one and
|
||||
* it's an autogenerated array, we can rename it out of the way.
|
||||
*/
|
||||
old_type_oid = GetSysCacheOid2(TYPENAMENSP,
|
||||
@ -1106,7 +1106,7 @@ DefineEnum(CreateEnumStmt *stmt)
|
||||
get_namespace_name(enumNamespace));
|
||||
|
||||
/*
|
||||
* Check for collision with an existing type name. If there is one and
|
||||
* Check for collision with an existing type name. If there is one and
|
||||
* it's an autogenerated array, we can rename it out of the way.
|
||||
*/
|
||||
old_type_oid = GetSysCacheOid2(TYPENAMENSP,
|
||||
@ -1764,7 +1764,7 @@ AlterDomainNotNull(List *names, bool notNull)
|
||||
}
|
||||
|
||||
/*
|
||||
* Okay to update pg_type row. We can scribble on typTup because it's a
|
||||
* Okay to update pg_type row. We can scribble on typTup because it's a
|
||||
* copy.
|
||||
*/
|
||||
typTup->typnotnull = notNull;
|
||||
@ -1937,7 +1937,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
|
||||
|
||||
/*
|
||||
* Since all other constraint types throw errors, this must be a check
|
||||
* constraint. First, process the constraint expression and add an entry
|
||||
* constraint. First, process the constraint expression and add an entry
|
||||
* to pg_constraint.
|
||||
*/
|
||||
|
||||
@ -2165,7 +2165,7 @@ get_rels_with_domain(Oid domainOid, LOCKMODE lockmode)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Okay, add column to result. We store the columns in column-number
|
||||
* Okay, add column to result. We store the columns in column-number
|
||||
* order; this is just a hack to improve predictability of regression
|
||||
* test output ...
|
||||
*/
|
||||
@ -2253,7 +2253,7 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
|
||||
|
||||
/*
|
||||
* Set up a CoerceToDomainValue to represent the occurrence of VALUE in
|
||||
* the expression. Note that it will appear to have the type of the base
|
||||
* the expression. Note that it will appear to have the type of the base
|
||||
* type, not the domain. This seems correct since within the check
|
||||
* expression, we should not assume the input value can be considered a
|
||||
* member of the domain.
|
||||
@ -2630,7 +2630,7 @@ AlterTypeOwner(List *names, Oid newOwnerId)
|
||||
|
||||
/*
|
||||
* If it's a composite type, invoke ATExecChangeOwner so that we fix
|
||||
* up the pg_class entry properly. That will call back to
|
||||
* up the pg_class entry properly. That will call back to
|
||||
* AlterTypeOwnerInternal to take care of the pg_type entry(s).
|
||||
*/
|
||||
if (typTup->typtype == TYPTYPE_COMPOSITE)
|
||||
@ -2751,7 +2751,7 @@ AlterTypeNamespace(List *names, const char *newschema)
|
||||
* Caller must have already checked privileges.
|
||||
*
|
||||
* The function automatically recurses to process the type's array type,
|
||||
* if any. isImplicitArray should be TRUE only when doing this internal
|
||||
* if any. isImplicitArray should be TRUE only when doing this internal
|
||||
* recursion (outside callers must never try to move an array type directly).
|
||||
*
|
||||
* If errorOnTableType is TRUE, the function errors out if the type is
|
||||
|
@ -910,7 +910,7 @@ DropRole(DropRoleStmt *stmt)
|
||||
ReleaseSysCache(tuple);
|
||||
|
||||
/*
|
||||
* Remove role from the pg_auth_members table. We have to remove all
|
||||
* Remove role from the pg_auth_members table. We have to remove all
|
||||
* tuples that show it as either a role or a member.
|
||||
*
|
||||
* XXX what about grantor entries? Maybe we should do one heap scan.
|
||||
@ -1005,7 +1005,7 @@ RenameRole(const char *oldname, const char *newname)
|
||||
* XXX Client applications probably store the session user somewhere, so
|
||||
* renaming it could cause confusion. On the other hand, there may not be
|
||||
* an actual problem besides a little confusion, so think about this and
|
||||
* decide. Same for SET ROLE ... we don't restrict renaming the current
|
||||
* decide. Same for SET ROLE ... we don't restrict renaming the current
|
||||
* effective userid, though.
|
||||
*/
|
||||
|
||||
@ -1257,7 +1257,7 @@ AddRoleMems(const char *rolename, Oid roleid,
|
||||
|
||||
/*
|
||||
* Check permissions: must have createrole or admin option on the role to
|
||||
* be changed. To mess with a superuser role, you gotta be superuser.
|
||||
* be changed. To mess with a superuser role, you gotta be superuser.
|
||||
*/
|
||||
if (superuser_arg(roleid))
|
||||
{
|
||||
@ -1403,7 +1403,7 @@ DelRoleMems(const char *rolename, Oid roleid,
|
||||
|
||||
/*
|
||||
* Check permissions: must have createrole or admin option on the role to
|
||||
* be changed. To mess with a superuser role, you gotta be superuser.
|
||||
* be changed. To mess with a superuser role, you gotta be superuser.
|
||||
*/
|
||||
if (superuser_arg(roleid))
|
||||
{
|
||||
|
@ -375,9 +375,9 @@ vacuum_set_xid_limits(int freeze_min_age,
|
||||
TransactionId safeLimit;
|
||||
|
||||
/*
|
||||
* We can always ignore processes running lazy vacuum. This is because we
|
||||
* We can always ignore processes running lazy vacuum. This is because we
|
||||
* use these values only for deciding which tuples we must keep in the
|
||||
* tables. Since lazy vacuum doesn't write its XID anywhere, it's safe to
|
||||
* tables. Since lazy vacuum doesn't write its XID anywhere, it's safe to
|
||||
* ignore it. In theory it could be problematic to ignore lazy vacuums in
|
||||
* a full vacuum, but keep in mind that only one vacuum process can be
|
||||
* working on a particular table at any time, and that each vacuum is
|
||||
@ -656,7 +656,7 @@ vac_update_relstats(Relation relation,
|
||||
* advance pg_database.datfrozenxid, also try to truncate pg_clog.
|
||||
*
|
||||
* We violate transaction semantics here by overwriting the database's
|
||||
* existing pg_database tuple with the new value. This is reasonably
|
||||
* existing pg_database tuple with the new value. This is reasonably
|
||||
* safe since the new value is correct whether or not this transaction
|
||||
* commits. As with vac_update_relstats, this avoids leaving dead tuples
|
||||
* behind after a VACUUM.
|
||||
@ -756,7 +756,7 @@ vac_update_datfrozenxid(void)
|
||||
* Also update the XID wrap limit info maintained by varsup.c.
|
||||
*
|
||||
* The passed XID is simply the one I just wrote into my pg_database
|
||||
* entry. It's used to initialize the "min" calculation.
|
||||
* entry. It's used to initialize the "min" calculation.
|
||||
*
|
||||
* This routine is only invoked when we've managed to change our
|
||||
* DB's datfrozenxid entry, or we found that the shared XID-wrap-limit
|
||||
@ -839,7 +839,7 @@ vac_truncate_clog(TransactionId frozenXID)
|
||||
* vacuum_rel() -- vacuum one heap relation
|
||||
*
|
||||
* Doing one heap at a time incurs extra overhead, since we need to
|
||||
* check that the heap exists again just before we vacuum it. The
|
||||
* check that the heap exists again just before we vacuum it. The
|
||||
* reason that we do this is so that vacuuming can be spread across
|
||||
* many small transactions. Otherwise, two-phase locking would require
|
||||
* us to lock the entire database during one pass of the vacuum cleaner.
|
||||
@ -896,7 +896,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for user-requested abort. Note we want this to be inside a
|
||||
* Check for user-requested abort. Note we want this to be inside a
|
||||
* transaction, so xact.c doesn't issue useless WARNING.
|
||||
*/
|
||||
CHECK_FOR_INTERRUPTS();
|
||||
@ -928,7 +928,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
|
||||
*
|
||||
* We allow the user to vacuum a table if he is superuser, the table
|
||||
* owner, or the database owner (but in the latter case, only if it's not
|
||||
* a shared relation). pg_class_ownercheck includes the superuser case.
|
||||
* a shared relation). pg_class_ownercheck includes the superuser case.
|
||||
*
|
||||
* Note we choose to treat permissions failure as a WARNING and keep
|
||||
* trying to vacuum the rest of the DB --- is this appropriate?
|
||||
@ -1056,7 +1056,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
|
||||
/*
|
||||
* If the relation has a secondary toast rel, vacuum that too while we
|
||||
* still hold the session lock on the master table. Note however that
|
||||
* "analyze" will not get done on the toast table. This is good, because
|
||||
* "analyze" will not get done on the toast table. This is good, because
|
||||
* the toaster always uses hardcoded index access and statistics are
|
||||
* totally unimportant for toast relations.
|
||||
*/
|
||||
@ -1072,7 +1072,7 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, bool do_toast, bool for_wraparound)
|
||||
|
||||
/*
|
||||
* Open all the vacuumable indexes of the given relation, obtaining the
|
||||
* specified kind of lock on each. Return an array of Relation pointers for
|
||||
* specified kind of lock on each. Return an array of Relation pointers for
|
||||
* the indexes into *Irel, and the number of indexes into *nindexes.
|
||||
*
|
||||
* We consider an index vacuumable if it is marked insertable (IndexIsReady).
|
||||
@ -1122,7 +1122,7 @@ vac_open_indexes(Relation relation, LOCKMODE lockmode,
|
||||
}
|
||||
|
||||
/*
|
||||
* Release the resources acquired by vac_open_indexes. Optionally release
|
||||
* Release the resources acquired by vac_open_indexes. Optionally release
|
||||
* the locks (say NoLock to keep 'em).
|
||||
*/
|
||||
void
|
||||
|
@ -13,7 +13,7 @@
|
||||
* We are willing to use at most maintenance_work_mem memory space to keep
|
||||
* track of dead tuples. We initially allocate an array of TIDs of that size,
|
||||
* with an upper limit that depends on table size (this limit ensures we don't
|
||||
* allocate a huge area uselessly for vacuuming small tables). If the array
|
||||
* allocate a huge area uselessly for vacuuming small tables). If the array
|
||||
* threatens to overflow, we suspend the heap scan phase and perform a pass of
|
||||
* index cleanup and page compaction, then resume the heap scan with an empty
|
||||
* TID array.
|
||||
@ -843,8 +843,8 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
|
||||
/*
|
||||
* If we remembered any tuples for deletion, then the page will be
|
||||
* visited again by lazy_vacuum_heap, which will compute and record
|
||||
* its post-compaction free space. If not, then we're done with this
|
||||
* page, so remember its free space as-is. (This path will always be
|
||||
* its post-compaction free space. If not, then we're done with this
|
||||
* page, so remember its free space as-is. (This path will always be
|
||||
* taken if there are no indexes.)
|
||||
*/
|
||||
if (vacrelstats->num_dead_tuples == prev_dead_count)
|
||||
|
@ -183,7 +183,7 @@ assign_datestyle(const char *value, bool doit, GucSource source)
|
||||
return value;
|
||||
|
||||
/*
|
||||
* Prepare the canonical string to return. GUC wants it malloc'd.
|
||||
* Prepare the canonical string to return. GUC wants it malloc'd.
|
||||
*/
|
||||
result = (char *) malloc(32);
|
||||
if (!result)
|
||||
@ -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.
|
||||
*/
|
||||
@ -335,7 +335,7 @@ assign_timezone(const char *value, bool doit, GucSource source)
|
||||
*
|
||||
* During GUC initialization, since the timezone library isn't set
|
||||
* up yet, pg_get_timezone_name will return NULL and we will leave
|
||||
* the setting as UNKNOWN. If this isn't overridden from the
|
||||
* the setting as UNKNOWN. If this isn't overridden from the
|
||||
* config file then pg_timezone_initialize() will eventually
|
||||
* select a default value from the environment.
|
||||
*/
|
||||
@ -391,7 +391,7 @@ assign_timezone(const char *value, bool doit, GucSource source)
|
||||
return value;
|
||||
|
||||
/*
|
||||
* Prepare the canonical string to return. GUC wants it malloc'd.
|
||||
* Prepare the canonical string to return. GUC wants it malloc'd.
|
||||
*/
|
||||
if (HasCTZSet)
|
||||
{
|
||||
@ -467,7 +467,7 @@ assign_log_timezone(const char *value, bool doit, GucSource source)
|
||||
*
|
||||
* During GUC initialization, since the timezone library isn't set up
|
||||
* yet, pg_get_timezone_name will return NULL and we will leave the
|
||||
* setting as UNKNOWN. If this isn't overridden from the config file
|
||||
* setting as UNKNOWN. If this isn't overridden from the config file
|
||||
* then pg_timezone_initialize() will eventually select a default
|
||||
* value from the environment.
|
||||
*/
|
||||
@ -521,7 +521,7 @@ assign_log_timezone(const char *value, bool doit, GucSource source)
|
||||
return value;
|
||||
|
||||
/*
|
||||
* Prepare the canonical string to return. GUC wants it malloc'd.
|
||||
* Prepare the canonical string to return. GUC wants it malloc'd.
|
||||
*/
|
||||
result = strdup(value);
|
||||
|
||||
@ -656,7 +656,7 @@ assign_client_encoding(const char *value, bool doit, GucSource source)
|
||||
|
||||
/*
|
||||
* Note: if we are in startup phase then SetClientEncoding may not be able
|
||||
* to really set the encoding. In this case we will assume that the
|
||||
* to really set the encoding. In this case we will assume that the
|
||||
* encoding is okay, and InitializeClientEncoding() will fix things once
|
||||
* initialization is complete.
|
||||
*/
|
||||
@ -684,7 +684,7 @@ assign_client_encoding(const char *value, bool doit, GucSource source)
|
||||
* limit on names, so we can tell whether we're being passed an initial
|
||||
* role name or a saved/restored value. (NOTE: we rely on guc.c to have
|
||||
* properly truncated any incoming value, but not to truncate already-stored
|
||||
* values. See GUC_IS_NAME processing.)
|
||||
* values. See GUC_IS_NAME processing.)
|
||||
*/
|
||||
extern char *session_authorization_string; /* in guc.c */
|
||||
|
||||
|
@ -344,11 +344,11 @@ UpdateRangeTableOfViewParse(Oid viewOid, Query *viewParse)
|
||||
*rt_entry2;
|
||||
|
||||
/*
|
||||
* Make a copy of the given parsetree. It's not so much that we don't
|
||||
* Make a copy of the given parsetree. It's not so much that we don't
|
||||
* want to scribble on our input, it's that the parser has a bad habit of
|
||||
* outputting multiple links to the same subtree for constructs like
|
||||
* BETWEEN, and we mustn't have OffsetVarNodes increment the varno of a
|
||||
* Var node twice. copyObject will expand any multiply-referenced subtree
|
||||
* Var node twice. copyObject will expand any multiply-referenced subtree
|
||||
* into multiple copies.
|
||||
*/
|
||||
viewParse = (Query *) copyObject(viewParse);
|
||||
@ -444,7 +444,7 @@ DefineView(ViewStmt *stmt, const char *queryString)
|
||||
|
||||
/*
|
||||
* If the user didn't explicitly ask for a temporary view, check whether
|
||||
* we need one implicitly. We allow TEMP to be inserted automatically as
|
||||
* we need one implicitly. We allow TEMP to be inserted automatically as
|
||||
* long as the CREATE command is consistent with that --- no explicit
|
||||
* schema name.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user