> On Jun 23, 2026, at 16:34, Akshay Joshi <[email protected]> wrote:
> 
> Hi Chao,
> 
> Patch looks good to me. I have added the following test cases in my local 
> version in "src/test/modules/test_misc/t/012_ddlutils.pl". If possible add 
> those and resend the patch
> 
> +# Options passed via VARIADIC ARRAY
> +$result = $node->safe_psql('postgres',
> +       q{SELECT * FROM pg_get_role_ddl('regress_role_ddl_test2',
> +           VARIADIC ARRAY['pretty', 'false'])});
> +unlike($result, qr/\n\s+SUPERUSER/,
> +       'role VARIADIC ARRAY pretty=false suppresses indentation');
> +like($result, qr/SUPERUSER/, 'role VARIADIC ARRAY pretty=false still emits 
> attributes');
> 
> 
> +# Options passed via VARIADIC ARRAY
> +$result = ddl_filter(
> +       $node->safe_psql(
> +               'postgres',
> +               q{SELECT pg_get_database_ddl
> +         FROM pg_get_database_ddl('regression_ddlutils_test',
> +           VARIADIC ARRAY['pretty', 'false'])}));
> +unlike($result, qr/\n\s+WITH TEMPLATE/,
> +       'database VARIADIC ARRAY pretty=false suppresses indentation');
> +like(
> +       $result,
> +       qr/CREATE DATABASE regression_ddlutils_test/,
> +       'database VARIADIC ARRAY still emits CREATE');
> 
> 
> +# Options passed via VARIADIC ARRAY (name variant)
> +$result = $node->safe_psql(
> +       'postgres',
> +       q{SELECT * FROM pg_get_tablespace_ddl('regress_allopt_tblsp',
> +         VARIADIC ARRAY['pretty', 'false'])});
> +unlike($result, qr/\n\s+OWNER/,
> +       'tablespace VARIADIC ARRAY pretty=false suppresses indentation 
> (name)');
> +like(
> +       $result,
> +       qr/OWNER regress_role_ddl_test1/,
> +       'tablespace VARIADIC ARRAY still emits OWNER (name)');
> +
> +# Options passed via VARIADIC ARRAY (oid variant)
> +$result = $node->safe_psql(
> +       'postgres', q{
> +       SELECT * FROM pg_get_tablespace_ddl(
> +         (SELECT oid FROM pg_tablespace
> +          WHERE spcname = 'regress_allopt_tblsp'),
> +         VARIADIC ARRAY['pretty', 'false'])});
> +unlike($result, qr/\n\s+OWNER/,
> +       'tablespace VARIADIC ARRAY pretty=false suppresses indentation 
> (oid)');
> +like(
> +       $result,
> +       qr/CREATE TABLESPACE regress_allopt_tblsp/,
> +       'tablespace VARIADIC ARRAY still emits CREATE (oid)');
> +
> 

Hi Akshay,

I actually considered adding VARIADIC ARRAY test cases when I worked on the 
patch, but I intentionally avoided them because I found that similar variadic 
functions, such as json_extract_path and jsonb_extract_path, don’t have such 
tests either. Also, the sanity check is now able to detect this problem.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/






Reply via email to