mirror of
https://github.com/postgres/postgres.git
synced 2025-07-20 05:03:10 +03:00
pgindent run for 9.0, second run
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
* formatting.c
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.170 2010/04/07 21:41:53 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.171 2010/07/06 19:18:58 momjian Exp $
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1999-2010, PostgreSQL Global Development Group
|
||||
@ -2658,12 +2658,13 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out)
|
||||
s += SKIP_THth(n->suffix);
|
||||
break;
|
||||
case DCH_Q:
|
||||
|
||||
/*
|
||||
* We ignore 'Q' when converting to date because it is
|
||||
* unclear which date in the quarter to use, and some
|
||||
* people specify both quarter and month, so if it was
|
||||
* honored it might conflict with the supplied month.
|
||||
* That is also why we don't throw an error.
|
||||
* We ignore 'Q' when converting to date because it is unclear
|
||||
* which date in the quarter to use, and some people specify
|
||||
* both quarter and month, so if it was honored it might
|
||||
* conflict with the supplied month. That is also why we don't
|
||||
* throw an error.
|
||||
*
|
||||
* We still parse the source string for an integer, but it
|
||||
* isn't stored anywhere in 'out'.
|
||||
|
@ -19,7 +19,7 @@
|
||||
* Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.29 2010/05/28 18:18:19 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.30 2010/07/06 19:18:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -116,10 +116,10 @@ MatchText(char *t, int tlen, char *p, int plen)
|
||||
* If there are wildcards immediately following the %, we can skip
|
||||
* over them first, using the idea that any sequence of N _'s and
|
||||
* one or more %'s is equivalent to N _'s and one % (ie, it will
|
||||
* match any sequence of at least N text characters). In this
|
||||
* way we will always run the recursive search loop using a
|
||||
* pattern fragment that begins with a literal character-to-match,
|
||||
* thereby not recursing more than we have to.
|
||||
* match any sequence of at least N text characters). In this way
|
||||
* we will always run the recursive search loop using a pattern
|
||||
* fragment that begins with a literal character-to-match, thereby
|
||||
* not recursing more than we have to.
|
||||
*/
|
||||
NextByte(p, plen);
|
||||
|
||||
@ -173,7 +173,7 @@ MatchText(char *t, int tlen, char *p, int plen)
|
||||
int matched = MatchText(t, tlen, p, plen);
|
||||
|
||||
if (matched != LIKE_FALSE)
|
||||
return matched; /* TRUE or ABORT */
|
||||
return matched; /* TRUE or ABORT */
|
||||
}
|
||||
|
||||
NextChar(t, tlen);
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.77 2010/06/13 17:43:13 rhaas Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.78 2010/07/06 19:18:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -314,15 +314,17 @@ oidparse(Node *node)
|
||||
case T_Integer:
|
||||
return intVal(node);
|
||||
case T_Float:
|
||||
|
||||
/*
|
||||
* Values too large for int4 will be represented as Float constants
|
||||
* by the lexer. Accept these if they are valid OID strings.
|
||||
* Values too large for int4 will be represented as Float
|
||||
* constants by the lexer. Accept these if they are valid OID
|
||||
* strings.
|
||||
*/
|
||||
return oidin_subr(strVal(node), NULL);
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
|
||||
}
|
||||
return InvalidOid; /* keep compiler quiet */
|
||||
return InvalidOid; /* keep compiler quiet */
|
||||
}
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Portions Copyright (c) 2002-2010, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.56 2010/04/26 14:17:52 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.57 2010/07/06 19:18:58 momjian Exp $
|
||||
*
|
||||
*-----------------------------------------------------------------------
|
||||
*/
|
||||
@ -44,7 +44,7 @@
|
||||
*
|
||||
* FYI, The Open Group locale standard is defined here:
|
||||
*
|
||||
* http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html
|
||||
* http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html
|
||||
*----------
|
||||
*/
|
||||
|
||||
@ -398,13 +398,13 @@ free_struct_lconv(struct lconv * s)
|
||||
static char *
|
||||
db_encoding_strdup(int encoding, const char *str)
|
||||
{
|
||||
char *pstr;
|
||||
char *mstr;
|
||||
char *pstr;
|
||||
char *mstr;
|
||||
|
||||
/* convert the string to the database encoding */
|
||||
pstr = (char *) pg_do_encoding_conversion(
|
||||
(unsigned char *) str, strlen(str),
|
||||
encoding, GetDatabaseEncoding());
|
||||
(unsigned char *) str, strlen(str),
|
||||
encoding, GetDatabaseEncoding());
|
||||
mstr = strdup(pstr);
|
||||
if (pstr != str)
|
||||
pfree(pstr);
|
||||
@ -428,6 +428,7 @@ PGLC_localeconv(void)
|
||||
char *grouping;
|
||||
char *thousands_sep;
|
||||
int encoding;
|
||||
|
||||
#ifdef WIN32
|
||||
char *save_lc_ctype;
|
||||
#endif
|
||||
@ -448,27 +449,27 @@ PGLC_localeconv(void)
|
||||
save_lc_numeric = pstrdup(save_lc_numeric);
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* Ideally, monetary and numeric local symbols could be returned in
|
||||
* any server encoding. Unfortunately, the WIN32 API does not allow
|
||||
* setlocale() to return values in a codepage/CTYPE that uses more
|
||||
* than two bytes per character, like UTF-8:
|
||||
*
|
||||
* http://msdn.microsoft.com/en-us/library/x99tb11d.aspx
|
||||
*
|
||||
* Evidently, LC_CTYPE allows us to control the encoding used
|
||||
* for strings returned by localeconv(). The Open Group
|
||||
* standard, mentioned at the top of this C file, doesn't
|
||||
* explicitly state this.
|
||||
*
|
||||
* Therefore, we set LC_CTYPE to match LC_NUMERIC or LC_MONETARY
|
||||
* (which cannot be UTF8), call localeconv(), and then convert from
|
||||
* the numeric/monitary LC_CTYPE to the server encoding. One
|
||||
* example use of this is for the Euro symbol.
|
||||
*
|
||||
* Perhaps someday we will use GetLocaleInfoW() which returns values
|
||||
* in UTF16 and convert from that.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Ideally, monetary and numeric local symbols could be returned in any
|
||||
* server encoding. Unfortunately, the WIN32 API does not allow
|
||||
* setlocale() to return values in a codepage/CTYPE that uses more than
|
||||
* two bytes per character, like UTF-8:
|
||||
*
|
||||
* http://msdn.microsoft.com/en-us/library/x99tb11d.aspx
|
||||
*
|
||||
* Evidently, LC_CTYPE allows us to control the encoding used for strings
|
||||
* returned by localeconv(). The Open Group standard, mentioned at the
|
||||
* top of this C file, doesn't explicitly state this.
|
||||
*
|
||||
* Therefore, we set LC_CTYPE to match LC_NUMERIC or LC_MONETARY (which
|
||||
* cannot be UTF8), call localeconv(), and then convert from the
|
||||
* numeric/monitary LC_CTYPE to the server encoding. One example use of
|
||||
* this is for the Euro symbol.
|
||||
*
|
||||
* Perhaps someday we will use GetLocaleInfoW() which returns values in
|
||||
* UTF16 and convert from that.
|
||||
*/
|
||||
|
||||
/* save user's value of ctype locale */
|
||||
save_lc_ctype = setlocale(LC_CTYPE, NULL);
|
||||
@ -567,6 +568,7 @@ strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm
|
||||
|
||||
len = wcsftime(wbuf, MAX_L10N_DATA, format, tm);
|
||||
if (len == 0)
|
||||
|
||||
/*
|
||||
* strftime call failed - return 0 with the contents of dst
|
||||
* unspecified
|
||||
@ -595,7 +597,6 @@ strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm
|
||||
|
||||
/* redefine strftime() */
|
||||
#define strftime(a,b,c,d) strftime_win32(a,b,L##c,d)
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
|
||||
@ -611,6 +612,7 @@ cache_locale_time(void)
|
||||
char buf[MAX_L10N_DATA];
|
||||
char *ptr;
|
||||
int i;
|
||||
|
||||
#ifdef WIN32
|
||||
char *save_lc_ctype;
|
||||
#endif
|
||||
@ -627,13 +629,14 @@ cache_locale_time(void)
|
||||
save_lc_time = pstrdup(save_lc_time);
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
/*
|
||||
* On WIN32, there is no way to get locale-specific time values in a
|
||||
* specified locale, like we do for monetary/numeric. We can only get
|
||||
* CP_ACP (see strftime_win32) or UTF16. Therefore, we get UTF16 and
|
||||
* convert it to the database locale. However, wcsftime() internally
|
||||
* uses LC_CTYPE, so we set it here. See the WIN32 comment near the
|
||||
* top of PGLC_localeconv().
|
||||
* convert it to the database locale. However, wcsftime() internally uses
|
||||
* LC_CTYPE, so we set it here. See the WIN32 comment near the top of
|
||||
* PGLC_localeconv().
|
||||
*/
|
||||
|
||||
/* save user's value of ctype locale */
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.97 2010/03/03 17:29:45 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.98 2010/07/06 19:18:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -846,7 +846,7 @@ xml_is_document(xmltype *arg)
|
||||
* pg_xml_init --- set up for use of libxml
|
||||
*
|
||||
* This should be called by each function that is about to use libxml
|
||||
* facilities. It has two responsibilities: verify compatibility with the
|
||||
* facilities. It has two responsibilities: verify compatibility with the
|
||||
* loaded libxml version (done on first call in a session) and establish
|
||||
* or re-establish our libxml error handler. The latter needs to be done
|
||||
* anytime we might have passed control to add-on modules (eg libperl) which
|
||||
@ -1121,7 +1121,7 @@ static bool
|
||||
print_xml_decl(StringInfo buf, const xmlChar *version,
|
||||
pg_enc encoding, int standalone)
|
||||
{
|
||||
pg_xml_init(); /* why is this here? */
|
||||
pg_xml_init(); /* why is this here? */
|
||||
|
||||
if ((version && strcmp((char *) version, PG_XML_DEFAULT_VERSION) != 0)
|
||||
|| (encoding && encoding != PG_UTF8)
|
||||
@ -1338,8 +1338,8 @@ xml_ereport(int level, int sqlcode, const char *msg)
|
||||
/*
|
||||
* It might seem that we should just pass xml_err_buf->data directly to
|
||||
* errdetail. However, we want to clean out xml_err_buf before throwing
|
||||
* error, in case there is another function using libxml further down
|
||||
* the call stack.
|
||||
* error, in case there is another function using libxml further down the
|
||||
* call stack.
|
||||
*/
|
||||
if (xml_err_buf->len > 0)
|
||||
{
|
||||
|
5
src/backend/utils/cache/catcache.c
vendored
5
src/backend/utils/cache/catcache.c
vendored
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.152 2010/04/20 23:48:47 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/catcache.c,v 1.153 2010/07/06 19:18:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -994,6 +994,7 @@ IndexScanOK(CatCache *cache, ScanKey cur_skey)
|
||||
switch (cache->id)
|
||||
{
|
||||
case INDEXRELID:
|
||||
|
||||
/*
|
||||
* Rather than tracking exactly which indexes have to be loaded
|
||||
* before we can use indexscans (which changes from time to time),
|
||||
@ -1006,6 +1007,7 @@ IndexScanOK(CatCache *cache, ScanKey cur_skey)
|
||||
|
||||
case AMOID:
|
||||
case AMNAME:
|
||||
|
||||
/*
|
||||
* Always do heap scans in pg_am, because it's so small there's
|
||||
* not much point in an indexscan anyway. We *must* do this when
|
||||
@ -1017,6 +1019,7 @@ IndexScanOK(CatCache *cache, ScanKey cur_skey)
|
||||
case AUTHNAME:
|
||||
case AUTHOID:
|
||||
case AUTHMEMMEMROLE:
|
||||
|
||||
/*
|
||||
* Protect authentication lookups occurring before relcache has
|
||||
* collected entries for shared indexes.
|
||||
|
20
src/backend/utils/cache/relcache.c
vendored
20
src/backend/utils/cache/relcache.c
vendored
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.310 2010/04/20 23:48:47 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/cache/relcache.c,v 1.311 2010/07/06 19:18:58 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1832,7 +1832,7 @@ RelationDestroyRelation(Relation relation)
|
||||
*
|
||||
* NB: when rebuilding, we'd better hold some lock on the relation,
|
||||
* else the catalog data we need to read could be changing under us.
|
||||
* Also, a rel to be rebuilt had better have refcnt > 0. This is because
|
||||
* Also, a rel to be rebuilt had better have refcnt > 0. This is because
|
||||
* an sinval reset could happen while we're accessing the catalogs, and
|
||||
* the rel would get blown away underneath us by RelationCacheInvalidate
|
||||
* if it has zero refcnt.
|
||||
@ -1847,8 +1847,8 @@ RelationClearRelation(Relation relation, bool rebuild)
|
||||
Oid old_reltype = relation->rd_rel->reltype;
|
||||
|
||||
/*
|
||||
* As per notes above, a rel to be rebuilt MUST have refcnt > 0; while
|
||||
* of course it would be a bad idea to blow away one with nonzero refcnt.
|
||||
* As per notes above, a rel to be rebuilt MUST have refcnt > 0; while of
|
||||
* course it would be a bad idea to blow away one with nonzero refcnt.
|
||||
*/
|
||||
Assert(rebuild ?
|
||||
!RelationHasReferenceCountZero(relation) :
|
||||
@ -2051,9 +2051,9 @@ RelationFlushRelation(Relation relation)
|
||||
* forget the "new" status of the relation, which is a useful
|
||||
* optimization to have. Ditto for the new-relfilenode status.
|
||||
*
|
||||
* The rel could have zero refcnt here, so temporarily increment
|
||||
* the refcnt to ensure it's safe to rebuild it. We can assume that
|
||||
* the current transaction has some lock on the rel already.
|
||||
* The rel could have zero refcnt here, so temporarily increment the
|
||||
* refcnt to ensure it's safe to rebuild it. We can assume that the
|
||||
* current transaction has some lock on the rel already.
|
||||
*/
|
||||
RelationIncrementReferenceCount(relation);
|
||||
RelationClearRelation(relation, true);
|
||||
@ -2064,7 +2064,7 @@ RelationFlushRelation(Relation relation)
|
||||
/*
|
||||
* Pre-existing rels can be dropped from the relcache if not open.
|
||||
*/
|
||||
bool rebuild = !RelationHasReferenceCountZero(relation);
|
||||
bool rebuild = !RelationHasReferenceCountZero(relation);
|
||||
|
||||
RelationClearRelation(relation, rebuild);
|
||||
}
|
||||
@ -2775,8 +2775,8 @@ RelationCacheInitializePhase2(void)
|
||||
RelationMapInitializePhase2();
|
||||
|
||||
/*
|
||||
* In bootstrap mode, the shared catalogs aren't there yet anyway,
|
||||
* so do nothing.
|
||||
* In bootstrap mode, the shared catalogs aren't there yet anyway, so do
|
||||
* nothing.
|
||||
*/
|
||||
if (IsBootstrapProcessingMode())
|
||||
return;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.212 2010/04/26 10:52:00 rhaas Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.213 2010/07/06 19:18:58 momjian Exp $
|
||||
*
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
@ -218,21 +218,22 @@ PerformAuthentication(Port *port)
|
||||
elog(FATAL, "could not disable timer for authorization timeout");
|
||||
|
||||
/*
|
||||
* Log connection for streaming replication even if Log_connections disabled.
|
||||
* Log connection for streaming replication even if Log_connections
|
||||
* disabled.
|
||||
*/
|
||||
if (am_walsender)
|
||||
{
|
||||
if (port->remote_port[0])
|
||||
ereport(LOG,
|
||||
(errmsg("replication connection authorized: user=%s host=%s port=%s",
|
||||
port->user_name,
|
||||
port->remote_host,
|
||||
port->remote_port)));
|
||||
(errmsg("replication connection authorized: user=%s host=%s port=%s",
|
||||
port->user_name,
|
||||
port->remote_host,
|
||||
port->remote_port)));
|
||||
else
|
||||
ereport(LOG,
|
||||
(errmsg("replication connection authorized: user=%s host=%s",
|
||||
port->user_name,
|
||||
port->remote_host)));
|
||||
port->user_name,
|
||||
port->remote_host)));
|
||||
}
|
||||
else if (Log_connections)
|
||||
ereport(LOG,
|
||||
@ -515,8 +516,8 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
|
||||
if (IsUnderPostmaster)
|
||||
{
|
||||
/*
|
||||
* The postmaster already started the XLOG machinery, but we need
|
||||
* to call InitXLOGAccess(), if the system isn't in hot-standby mode.
|
||||
* The postmaster already started the XLOG machinery, but we need to
|
||||
* call InitXLOGAccess(), if the system isn't in hot-standby mode.
|
||||
* This is handled by calling RecoveryInProgress and ignoring the
|
||||
* result.
|
||||
*/
|
||||
@ -525,9 +526,9 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We are either a bootstrap process or a standalone backend.
|
||||
* Either way, start up the XLOG machinery, and register to have it
|
||||
* closed down at exit.
|
||||
* We are either a bootstrap process or a standalone backend. Either
|
||||
* way, start up the XLOG machinery, and register to have it closed
|
||||
* down at exit.
|
||||
*/
|
||||
StartupXLOG();
|
||||
on_shmem_exit(ShutdownXLOG, 0);
|
||||
@ -618,8 +619,8 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're trying to shut down, only superusers can connect, and
|
||||
* new replication connections are not allowed.
|
||||
* If we're trying to shut down, only superusers can connect, and new
|
||||
* replication connections are not allowed.
|
||||
*/
|
||||
if ((!am_superuser || am_walsender) &&
|
||||
MyProcPort != NULL &&
|
||||
@ -628,18 +629,18 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username,
|
||||
if (am_walsender)
|
||||
ereport(FATAL,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
errmsg("new replication connections are not allowed during database shutdown")));
|
||||
errmsg("new replication connections are not allowed during database shutdown")));
|
||||
else
|
||||
ereport(FATAL,
|
||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||
errmsg("must be superuser to connect during database shutdown")));
|
||||
errmsg("must be superuser to connect during database shutdown")));
|
||||
}
|
||||
|
||||
/*
|
||||
* The last few connections slots are reserved for superusers.
|
||||
* Although replication connections currently require superuser
|
||||
* privileges, we don't allow them to consume the reserved slots,
|
||||
* which are intended for interactive use.
|
||||
* The last few connections slots are reserved for superusers. Although
|
||||
* replication connections currently require superuser privileges, we
|
||||
* don't allow them to consume the reserved slots, which are intended for
|
||||
* interactive use.
|
||||
*/
|
||||
if ((!am_superuser || am_walsender) &&
|
||||
ReservedBackends > 0 &&
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Tatsuo Ishii
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.95 2010/02/27 03:55:52 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.96 2010/07/06 19:18:58 momjian Exp $
|
||||
*/
|
||||
#include "postgres.h"
|
||||
|
||||
@ -1016,7 +1016,7 @@ pgwin32_toUTF16(const char *str, int len, int *utf16len)
|
||||
{
|
||||
utf16 = (WCHAR *) palloc(sizeof(WCHAR) * (len + 1));
|
||||
dstlen = MultiByteToWideChar(codepage, 0, str, len, utf16, len);
|
||||
utf16[dstlen] = L'\0';
|
||||
utf16[dstlen] = L '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1029,7 +1029,7 @@ pgwin32_toUTF16(const char *str, int len, int *utf16len)
|
||||
|
||||
utf16 = (WCHAR *) palloc(sizeof(WCHAR) * (len + 1));
|
||||
dstlen = MultiByteToWideChar(CP_UTF8, 0, utf8, len, utf16, len);
|
||||
utf16[dstlen] = L'\0';
|
||||
utf16[dstlen] = L '\0';
|
||||
|
||||
if (utf8 != str)
|
||||
pfree(utf8);
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.559 2010/07/03 21:23:58 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.560 2010/07/06 19:18:58 momjian Exp $
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
*/
|
||||
@ -2893,7 +2893,7 @@ static void ShowAllGUCConfig(DestReceiver *dest);
|
||||
static char *_ShowOption(struct config_generic * record, bool use_units);
|
||||
static bool is_newvalue_equal(struct config_generic * record, const char *newvalue);
|
||||
static bool validate_option_array_item(const char *name, const char *value,
|
||||
bool skipIfNoPermissions);
|
||||
bool skipIfNoPermissions);
|
||||
|
||||
|
||||
/*
|
||||
@ -5905,12 +5905,13 @@ define_custom_variable(struct config_generic * variable)
|
||||
case PGC_S_DATABASE:
|
||||
case PGC_S_USER:
|
||||
case PGC_S_DATABASE_USER:
|
||||
|
||||
/*
|
||||
* The existing value came from an ALTER ROLE/DATABASE SET command.
|
||||
* We can assume that at the time the command was issued, we
|
||||
* checked that the issuing user was superuser if the variable
|
||||
* requires superuser privileges to set. So it's safe to
|
||||
* use SUSET context here.
|
||||
* The existing value came from an ALTER ROLE/DATABASE SET
|
||||
* command. We can assume that at the time the command was issued,
|
||||
* we checked that the issuing user was superuser if the variable
|
||||
* requires superuser privileges to set. So it's safe to use
|
||||
* SUSET context here.
|
||||
*/
|
||||
phcontext = PGC_SUSET;
|
||||
break;
|
||||
@ -5918,9 +5919,10 @@ define_custom_variable(struct config_generic * variable)
|
||||
case PGC_S_CLIENT:
|
||||
case PGC_S_SESSION:
|
||||
default:
|
||||
|
||||
/*
|
||||
* We must assume that the value came from an untrusted user,
|
||||
* even if the current_user is a superuser.
|
||||
* We must assume that the value came from an untrusted user, even
|
||||
* if the current_user is a superuser.
|
||||
*/
|
||||
phcontext = PGC_USERSET;
|
||||
break;
|
||||
@ -7443,7 +7445,7 @@ GUCArrayReset(ArrayType *array)
|
||||
* Validate a proposed option setting for GUCArrayAdd/Delete/Reset.
|
||||
*
|
||||
* name is the option name. value is the proposed value for the Add case,
|
||||
* or NULL for the Delete/Reset cases. If skipIfNoPermissions is true, it's
|
||||
* or NULL for the Delete/Reset cases. If skipIfNoPermissions is true, it's
|
||||
* not an error to have no permissions to set the option.
|
||||
*
|
||||
* Returns TRUE if OK, FALSE if skipIfNoPermissions is true and user does not
|
||||
@ -7465,19 +7467,19 @@ validate_option_array_item(const char *name, const char *value,
|
||||
* SUSET and user is superuser).
|
||||
*
|
||||
* name is not known, but exists or can be created as a placeholder
|
||||
* (implying it has a prefix listed in custom_variable_classes).
|
||||
* We allow this case if you're a superuser, otherwise not. Superusers
|
||||
* are assumed to know what they're doing. We can't allow it for other
|
||||
* users, because when the placeholder is resolved it might turn out to
|
||||
* be a SUSET variable; define_custom_variable assumes we checked that.
|
||||
* (implying it has a prefix listed in custom_variable_classes). We allow
|
||||
* this case if you're a superuser, otherwise not. Superusers are assumed
|
||||
* to know what they're doing. We can't allow it for other users, because
|
||||
* when the placeholder is resolved it might turn out to be a SUSET
|
||||
* variable; define_custom_variable assumes we checked that.
|
||||
*
|
||||
* name is not known and can't be created as a placeholder. Throw error,
|
||||
* unless skipIfNoPermissions is true, in which case return FALSE.
|
||||
* (It's tempting to allow this case to superusers, if the name is
|
||||
* qualified but not listed in custom_variable_classes. That would
|
||||
* ease restoring of dumps containing ALTER ROLE/DATABASE SET. However,
|
||||
* it's not clear that this usage justifies such a loss of error checking.
|
||||
* You can always fix custom_variable_classes before you restore.)
|
||||
* unless skipIfNoPermissions is true, in which case return FALSE. (It's
|
||||
* tempting to allow this case to superusers, if the name is qualified but
|
||||
* not listed in custom_variable_classes. That would ease restoring of
|
||||
* dumps containing ALTER ROLE/DATABASE SET. However, it's not clear that
|
||||
* this usage justifies such a loss of error checking. You can always fix
|
||||
* custom_variable_classes before you restore.)
|
||||
*/
|
||||
gconf = find_option(name, true, WARNING);
|
||||
if (!gconf)
|
||||
@ -7487,7 +7489,7 @@ validate_option_array_item(const char *name, const char *value,
|
||||
return false;
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
errmsg("unrecognized configuration parameter \"%s\"", name)));
|
||||
errmsg("unrecognized configuration parameter \"%s\"", name)));
|
||||
}
|
||||
|
||||
if (gconf->flags & GUC_CUSTOM_PLACEHOLDER)
|
||||
@ -7507,9 +7509,9 @@ validate_option_array_item(const char *name, const char *value,
|
||||
|
||||
/* manual permissions check so we can avoid an error being thrown */
|
||||
if (gconf->context == PGC_USERSET)
|
||||
/* ok */ ;
|
||||
/* ok */ ;
|
||||
else if (gconf->context == PGC_SUSET && superuser())
|
||||
/* ok */ ;
|
||||
/* ok */ ;
|
||||
else if (skipIfNoPermissions)
|
||||
return false;
|
||||
/* if a permissions error should be thrown, let set_config_option do it */
|
||||
|
@ -5,7 +5,7 @@
|
||||
* to contain some useful information. Mechanism differs wildly across
|
||||
* platforms.
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.41 2010/05/27 19:19:38 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/ps_status.c,v 1.42 2010/07/06 19:18:59 momjian Exp $
|
||||
*
|
||||
* Copyright (c) 2000-2010, PostgreSQL Global Development Group
|
||||
* various details abducted from various places
|
||||
@ -94,7 +94,7 @@ static size_t ps_buffer_size; /* space determined at run time */
|
||||
static size_t last_status_len; /* use to minimize length of clobber */
|
||||
#endif /* PS_USE_CLOBBER_ARGV */
|
||||
|
||||
static size_t ps_buffer_cur_len; /* nominal strlen(ps_buffer) */
|
||||
static size_t ps_buffer_cur_len; /* nominal strlen(ps_buffer) */
|
||||
|
||||
static size_t ps_buffer_fixed_size; /* size of the constant prefix */
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.119 2010/07/05 09:27:17 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/mmgr/portalmem.c,v 1.120 2010/07/06 19:18:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -775,9 +775,9 @@ AtCleanup_Portals(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* If a portal is still pinned, forcibly unpin it. PortalDrop will
|
||||
* not let us drop the portal otherwise. Whoever pinned the portal
|
||||
* was interrupted by the abort too and won't try to use it anymore.
|
||||
* If a portal is still pinned, forcibly unpin it. PortalDrop will not
|
||||
* let us drop the portal otherwise. Whoever pinned the portal was
|
||||
* interrupted by the abort too and won't try to use it anymore.
|
||||
*/
|
||||
if (portal->portalPinned)
|
||||
portal->portalPinned = false;
|
||||
|
Reference in New Issue
Block a user