mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Support hex-string input and output for type BYTEA.
Both hex format and the traditional "escape" format are automatically handled on input. The output format is selected by the new GUC variable bytea_output. As committed, bytea_output defaults to HEX, which is an *incompatible change*. We will keep it this way for awhile for testing purposes, but should consider whether to switch to the more backwards-compatible default of ESCAPE before 8.5 is released. Peter Eisentraut
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
* Written by Peter Eisentraut <peter_e@gmx.net>.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.509 2009/07/22 17:00:23 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.510 2009/08/04 16:08:36 tgl Exp $
|
||||
*
|
||||
*--------------------------------------------------------------------
|
||||
*/
|
||||
@ -61,6 +61,7 @@
|
||||
#include "tcop/tcopprot.h"
|
||||
#include "tsearch/ts_cache.h"
|
||||
#include "utils/builtins.h"
|
||||
#include "utils/bytea.h"
|
||||
#include "utils/guc_tables.h"
|
||||
#include "utils/memutils.h"
|
||||
#include "utils/pg_locale.h"
|
||||
@ -180,6 +181,12 @@ static char *config_enum_get_options(struct config_enum * record,
|
||||
* NOTE! Option values may not contain double quotes!
|
||||
*/
|
||||
|
||||
static const struct config_enum_entry bytea_output_options[] = {
|
||||
{"escape", BYTEA_OUTPUT_ESCAPE, false},
|
||||
{"hex", BYTEA_OUTPUT_HEX, false},
|
||||
{NULL, 0, false}
|
||||
};
|
||||
|
||||
/*
|
||||
* We have different sets for client and server message level options because
|
||||
* they sort slightly different (see "log" level)
|
||||
@ -2540,6 +2547,15 @@ static struct config_enum ConfigureNamesEnum[] =
|
||||
BACKSLASH_QUOTE_SAFE_ENCODING, backslash_quote_options, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"bytea_output", PGC_USERSET, CLIENT_CONN_STATEMENT,
|
||||
gettext_noop("Sets the output format for bytea."),
|
||||
NULL
|
||||
},
|
||||
&bytea_output,
|
||||
BYTEA_OUTPUT_HEX, bytea_output_options, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"client_min_messages", PGC_USERSET, LOGGING_WHEN,
|
||||
gettext_noop("Sets the message levels that are sent to the client."),
|
||||
|
Reference in New Issue
Block a user