mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Fix unintentional 'NULL' string literal in pg_upgrade.
Introduced in 2a083ab807
.
Discussion: https://postgr.es/m/e852442da35b4f31acc600ed98bbee0f12e65e0c.camel@j-davis.com
Reviewed-by: Michael Paquier <michael@paquier.xyz>
This commit is contained in:
@ -441,7 +441,6 @@ set_locale_and_encoding(void)
|
|||||||
char *datcollate_literal;
|
char *datcollate_literal;
|
||||||
char *datctype_literal;
|
char *datctype_literal;
|
||||||
char *datlocale_literal = NULL;
|
char *datlocale_literal = NULL;
|
||||||
char *datlocale_src;
|
|
||||||
DbLocaleInfo *locale = old_cluster.template0;
|
DbLocaleInfo *locale = old_cluster.template0;
|
||||||
|
|
||||||
prep_status("Setting locale and encoding for new cluster");
|
prep_status("Setting locale and encoding for new cluster");
|
||||||
@ -455,10 +454,13 @@ set_locale_and_encoding(void)
|
|||||||
datctype_literal = PQescapeLiteral(conn_new_template1,
|
datctype_literal = PQescapeLiteral(conn_new_template1,
|
||||||
locale->db_ctype,
|
locale->db_ctype,
|
||||||
strlen(locale->db_ctype));
|
strlen(locale->db_ctype));
|
||||||
datlocale_src = locale->db_locale ? locale->db_locale : "NULL";
|
|
||||||
|
if (locale->db_locale)
|
||||||
datlocale_literal = PQescapeLiteral(conn_new_template1,
|
datlocale_literal = PQescapeLiteral(conn_new_template1,
|
||||||
datlocale_src,
|
locale->db_locale,
|
||||||
strlen(datlocale_src));
|
strlen(locale->db_locale));
|
||||||
|
else
|
||||||
|
datlocale_literal = "NULL";
|
||||||
|
|
||||||
/* update template0 in new cluster */
|
/* update template0 in new cluster */
|
||||||
if (GET_MAJOR_VERSION(new_cluster.major_version) >= 1700)
|
if (GET_MAJOR_VERSION(new_cluster.major_version) >= 1700)
|
||||||
@ -502,6 +504,7 @@ set_locale_and_encoding(void)
|
|||||||
|
|
||||||
PQfreemem(datcollate_literal);
|
PQfreemem(datcollate_literal);
|
||||||
PQfreemem(datctype_literal);
|
PQfreemem(datctype_literal);
|
||||||
|
if (locale->db_locale)
|
||||||
PQfreemem(datlocale_literal);
|
PQfreemem(datlocale_literal);
|
||||||
|
|
||||||
PQfinish(conn_new_template1);
|
PQfinish(conn_new_template1);
|
||||||
|
Reference in New Issue
Block a user