mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +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 *datctype_literal;
|
||||
char *datlocale_literal = NULL;
|
||||
char *datlocale_src;
|
||||
DbLocaleInfo *locale = old_cluster.template0;
|
||||
|
||||
prep_status("Setting locale and encoding for new cluster");
|
||||
@ -455,10 +454,13 @@ set_locale_and_encoding(void)
|
||||
datctype_literal = PQescapeLiteral(conn_new_template1,
|
||||
locale->db_ctype,
|
||||
strlen(locale->db_ctype));
|
||||
datlocale_src = locale->db_locale ? locale->db_locale : "NULL";
|
||||
datlocale_literal = PQescapeLiteral(conn_new_template1,
|
||||
datlocale_src,
|
||||
strlen(datlocale_src));
|
||||
|
||||
if (locale->db_locale)
|
||||
datlocale_literal = PQescapeLiteral(conn_new_template1,
|
||||
locale->db_locale,
|
||||
strlen(locale->db_locale));
|
||||
else
|
||||
datlocale_literal = "NULL";
|
||||
|
||||
/* update template0 in new cluster */
|
||||
if (GET_MAJOR_VERSION(new_cluster.major_version) >= 1700)
|
||||
@ -502,7 +504,8 @@ set_locale_and_encoding(void)
|
||||
|
||||
PQfreemem(datcollate_literal);
|
||||
PQfreemem(datctype_literal);
|
||||
PQfreemem(datlocale_literal);
|
||||
if (locale->db_locale)
|
||||
PQfreemem(datlocale_literal);
|
||||
|
||||
PQfinish(conn_new_template1);
|
||||
|
||||
|
Reference in New Issue
Block a user