This is an automated email from the ASF dual-hosted git repository.
maxyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
The following commit(s) were added to refs/heads/main by this push:
new 721a60d3878 pg_dump support ao/aocs tables.
721a60d3878 is described below
commit 721a60d38786a7b07229751a988979b061c8b540
Author: zhangwenchao <[email protected]>
AuthorDate: Wed Jul 23 11:38:39 2025 +0800
pg_dump support ao/aocs tables.
Fix dump ao/aoco tables with appendonly and orientation reloptions
in pg_dump.
Authored-by: Zhangwenchao [email protected]
---
src/bin/pg_dump/pg_dump.c | 19 ++++++++++++++++++-
src/bin/pg_dump/t/002_pg_dump.pl | 21 +++++++++++++++++++++
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index cb4b6e1db4c..03422bed2fe 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -18111,13 +18111,30 @@ dumpTableSchema(Archive *fout, const TableInfo
*tbinfo)
actual_atts = 0;
if (nonemptyReloptions(tbinfo->reloptions) ||
- nonemptyReloptions(tbinfo->toast_reloptions))
+ nonemptyReloptions(tbinfo->toast_reloptions) ||
+ (tbinfo->amoid &&
+ (tbinfo->amoid == AO_ROW_TABLE_AM_OID ||
+ tbinfo->amoid == AO_COLUMN_TABLE_AM_OID)))
{
bool addcomma = false;
appendPQExpBufferStr(q, "\nWITH (");
+ if (tbinfo->amoid && tbinfo->amoid ==
AO_ROW_TABLE_AM_OID)
+ {
+ addcomma = true;
+ appendPQExpBufferStr(q, "appendonly = true");
+ }
+ else if (tbinfo->amoid && tbinfo->amoid ==
AO_COLUMN_TABLE_AM_OID)
+ {
+ addcomma = true;
+ appendPQExpBufferStr(q, "appendonly = true,
orientation = column");
+ }
+
if (nonemptyReloptions(tbinfo->reloptions))
{
+ if (addcomma)
+ appendPQExpBufferStr(q, ", ");
+
addcomma = true;
appendReloptionsArrayAH(q, tbinfo->reloptions,
"", fout);
}
diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
index 32845170092..07941190b6a 100644
--- a/src/bin/pg_dump/t/002_pg_dump.pl
+++ b/src/bin/pg_dump/t/002_pg_dump.pl
@@ -2200,6 +2200,27 @@ my %tests = (
unlike => { exclude_dump_test_schema => 1, },
},
+ 'CREATE APPEND OPTIMIZED ao_table' => {
+ create_order => 19,
+ create_sql => 'CREATE TABLE dump_test.test_table_ao(a
integer, b text)
+ WITH (appendonly = true,
compresstype = zlib, compresslevel = 1);',
+ regexp => qr/^
+ \QCREATE TABLE dump_test.test_table_ao (\E\n
+ \s+\Qa integer,\E\n
+ \s+\Qb text\E\n
+ \QWITH (appendonly = true, orientation = column,
compresstype = zlib, compresslevel = 1);\E\n/xm,
+ like => {
+ %full_runs,
+ %dump_test_schema_runs,
+ only_dump_test_table => 1,
+ section_pre_data => 1,
+ },
+ unlike => {
+ exclude_dump_test_schema => 1,
+ exclude_test_table => 1,
+ },
+ },
+
'CREATE POLICY p1 ON test_table' => {
create_order => 22,
create_sql => 'CREATE POLICY p1 ON dump_test.test_table
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]