mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
pg_dump: Dump colliculocale
This was forgotten when the new column was introduced. Author: Marina Polyakova <m.polyakova@postgrespro.ru> Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Discussion: https://www.postgresql.org/message-id/7ad26354e75259f59c4a6c6997b8ee32%40postgrespro.ru
This commit is contained in:
parent
3d3c05c70f
commit
72b6828da3
@ -17,6 +17,7 @@ top_builddir = ../../..
|
|||||||
include $(top_builddir)/src/Makefile.global
|
include $(top_builddir)/src/Makefile.global
|
||||||
|
|
||||||
export GZIP_PROGRAM=$(GZIP)
|
export GZIP_PROGRAM=$(GZIP)
|
||||||
|
export with_icu
|
||||||
|
|
||||||
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
|
override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
|
||||||
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
|
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
|
||||||
|
@ -13077,9 +13077,11 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
|
|||||||
int i_collisdeterministic;
|
int i_collisdeterministic;
|
||||||
int i_collcollate;
|
int i_collcollate;
|
||||||
int i_collctype;
|
int i_collctype;
|
||||||
|
int i_colliculocale;
|
||||||
const char *collprovider;
|
const char *collprovider;
|
||||||
const char *collcollate;
|
const char *collcollate;
|
||||||
const char *collctype;
|
const char *collctype;
|
||||||
|
const char *colliculocale;
|
||||||
|
|
||||||
/* Do nothing in data-only dump */
|
/* Do nothing in data-only dump */
|
||||||
if (dopt->dataOnly)
|
if (dopt->dataOnly)
|
||||||
@ -13110,6 +13112,13 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
|
|||||||
appendPQExpBufferStr(query,
|
appendPQExpBufferStr(query,
|
||||||
"true AS collisdeterministic, ");
|
"true AS collisdeterministic, ");
|
||||||
|
|
||||||
|
if (fout->remoteVersion >= 150000)
|
||||||
|
appendPQExpBufferStr(query,
|
||||||
|
"colliculocale, ");
|
||||||
|
else
|
||||||
|
appendPQExpBufferStr(query,
|
||||||
|
"NULL AS colliculocale, ");
|
||||||
|
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBuffer(query,
|
||||||
"collcollate, "
|
"collcollate, "
|
||||||
"collctype "
|
"collctype "
|
||||||
@ -13123,10 +13132,24 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
|
|||||||
i_collisdeterministic = PQfnumber(res, "collisdeterministic");
|
i_collisdeterministic = PQfnumber(res, "collisdeterministic");
|
||||||
i_collcollate = PQfnumber(res, "collcollate");
|
i_collcollate = PQfnumber(res, "collcollate");
|
||||||
i_collctype = PQfnumber(res, "collctype");
|
i_collctype = PQfnumber(res, "collctype");
|
||||||
|
i_colliculocale = PQfnumber(res, "colliculocale");
|
||||||
|
|
||||||
collprovider = PQgetvalue(res, 0, i_collprovider);
|
collprovider = PQgetvalue(res, 0, i_collprovider);
|
||||||
|
|
||||||
|
if (!PQgetisnull(res, 0, i_collcollate))
|
||||||
collcollate = PQgetvalue(res, 0, i_collcollate);
|
collcollate = PQgetvalue(res, 0, i_collcollate);
|
||||||
|
else
|
||||||
|
collcollate = NULL;
|
||||||
|
|
||||||
|
if (!PQgetisnull(res, 0, i_collctype))
|
||||||
collctype = PQgetvalue(res, 0, i_collctype);
|
collctype = PQgetvalue(res, 0, i_collctype);
|
||||||
|
else
|
||||||
|
collctype = NULL;
|
||||||
|
|
||||||
|
if (!PQgetisnull(res, 0, i_colliculocale))
|
||||||
|
colliculocale = PQgetvalue(res, 0, i_colliculocale);
|
||||||
|
else
|
||||||
|
colliculocale = NULL;
|
||||||
|
|
||||||
appendPQExpBuffer(delq, "DROP COLLATION %s;\n",
|
appendPQExpBuffer(delq, "DROP COLLATION %s;\n",
|
||||||
fmtQualifiedDumpable(collinfo));
|
fmtQualifiedDumpable(collinfo));
|
||||||
@ -13149,6 +13172,16 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
|
|||||||
if (strcmp(PQgetvalue(res, 0, i_collisdeterministic), "f") == 0)
|
if (strcmp(PQgetvalue(res, 0, i_collisdeterministic), "f") == 0)
|
||||||
appendPQExpBufferStr(q, ", deterministic = false");
|
appendPQExpBufferStr(q, ", deterministic = false");
|
||||||
|
|
||||||
|
if (colliculocale != NULL)
|
||||||
|
{
|
||||||
|
appendPQExpBufferStr(q, ", locale = ");
|
||||||
|
appendStringLiteralAH(q, colliculocale, fout);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert(collcollate != NULL);
|
||||||
|
Assert(collctype != NULL);
|
||||||
|
|
||||||
if (strcmp(collcollate, collctype) == 0)
|
if (strcmp(collcollate, collctype) == 0)
|
||||||
{
|
{
|
||||||
appendPQExpBufferStr(q, ", locale = ");
|
appendPQExpBufferStr(q, ", locale = ");
|
||||||
@ -13161,6 +13194,7 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
|
|||||||
appendPQExpBufferStr(q, ", lc_ctype = ");
|
appendPQExpBufferStr(q, ", lc_ctype = ");
|
||||||
appendStringLiteralAH(q, collctype, fout);
|
appendStringLiteralAH(q, collctype, fout);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For binary upgrade, carry over the collation version. For normal
|
* For binary upgrade, carry over the collation version. For normal
|
||||||
|
@ -1593,6 +1593,15 @@ my %tests = (
|
|||||||
like => { %full_runs, section_pre_data => 1, },
|
like => { %full_runs, section_pre_data => 1, },
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'CREATE COLLATION icu_collation' => {
|
||||||
|
create_order => 76,
|
||||||
|
create_sql => "CREATE COLLATION icu_collation (PROVIDER = icu, LOCALE = 'C');",
|
||||||
|
regexp =>
|
||||||
|
qr/CREATE COLLATION public.icu_collation \(provider = icu, locale = 'C'(, version = '[^']*')?\);/m,
|
||||||
|
icu => 1,
|
||||||
|
like => { %full_runs, section_pre_data => 1, },
|
||||||
|
},
|
||||||
|
|
||||||
'CREATE CAST FOR timestamptz' => {
|
'CREATE CAST FOR timestamptz' => {
|
||||||
create_order => 51,
|
create_order => 51,
|
||||||
create_sql =>
|
create_sql =>
|
||||||
@ -3868,7 +3877,7 @@ if ($collation_check_stderr !~ /ERROR: /)
|
|||||||
$collation_support = 1;
|
$collation_support = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine whether build supports LZ4 and gzip.
|
my $supports_icu = ($ENV{with_icu} eq 'yes');
|
||||||
my $supports_lz4 = check_pg_config("#define USE_LZ4 1");
|
my $supports_lz4 = check_pg_config("#define USE_LZ4 1");
|
||||||
my $supports_gzip = check_pg_config("#define HAVE_LIBZ 1");
|
my $supports_gzip = check_pg_config("#define HAVE_LIBZ 1");
|
||||||
|
|
||||||
@ -3909,6 +3918,11 @@ foreach my $test (
|
|||||||
$test_db = $tests{$test}->{database};
|
$test_db = $tests{$test}->{database};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined($tests{$test}->{icu}))
|
||||||
|
{
|
||||||
|
$tests{$test}->{collation} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ($tests{$test}->{create_sql})
|
if ($tests{$test}->{create_sql})
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -3918,6 +3932,12 @@ foreach my $test (
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Skip any icu-related collation commands if build was without icu
|
||||||
|
if (!$supports_icu && defined($tests{$test}->{icu}))
|
||||||
|
{
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
# Skip tests specific to LZ4 if this build does not support
|
# Skip tests specific to LZ4 if this build does not support
|
||||||
# this option.
|
# this option.
|
||||||
if (!$supports_lz4 && defined($tests{$test}->{lz4}))
|
if (!$supports_lz4 && defined($tests{$test}->{lz4}))
|
||||||
@ -4119,6 +4139,12 @@ foreach my $run (sort keys %pgdump_runs)
|
|||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Skip any icu-related collation commands if build was without icu
|
||||||
|
if (!$supports_icu && defined($tests{$test}->{icu}))
|
||||||
|
{
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
# Skip tests specific to LZ4 if this build does not support
|
# Skip tests specific to LZ4 if this build does not support
|
||||||
# this option.
|
# this option.
|
||||||
if (!$supports_lz4 && defined($tests{$test}->{lz4}))
|
if (!$supports_lz4 && defined($tests{$test}->{lz4}))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user