On Fri, Aug 22, 2025 at 4:59 PM Kirill Reshke <reshkekirill@gmail.com> wrote:
>
> >
> > the full <schema definition> in 11.1 is:
> > 11.1 <schema definition>
> >
> > <schema element> ::=
> > <table definition>
> > | <view definition>
> > | <domain definition>
> > | <character set definition>
> > | <collation definition>
> > | <transliteration definition>
> > | <assertion definition>
> > | <trigger definition>
> > | <user-defined type definition>
> > | <user-defined cast definition>
> > | <user-defined ordering definition>
> > | <transform definition>
> > | <schema routine>
> > | <sequence generator definition>
> > | <grant statement>
> > | <role definition>
> >
>
I also added CREATE SCHEMA CREATE TYPE.
> With these patches applied:
> ```
> reshke=# create schema sh1 create type tp as (i text);
> ERROR: unrecognized node type: 226
> ```
> Without patches it will be a syntax error.
>
This issue is solved in V7.
>
> Also we need a better error message in this:
> "CREATE SCHEMA ... CREATE OBJECT currently not support for..."
>
> First of all, is it s/support/supported/ ? Also would vote for
> something like "%s is not yet supported inside schema definition."
> WDYT?
>
"%s is not yet supported inside schema definition." is good option,
but how about
ereport(ERROR,
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("CREATE SCHEMA ... CREATE %s currently not supported",
asc_toupper(stringify_objtype(stmt->kind),
strlen(stringify_objtype(stmt->kind)))))
stringify_objtype will produce the object type name, then capitalize it.
IMHO, now the error message would be more explicit.
+--fail. only support collation object for DefineStmt node
+CREATE SCHEMA regress_schema_4 AUTHORIZATION CURRENT_ROLE
+ CREATE AGGREGATE balk(int4)(SFUNC = int4_sum(int8, int4),STYPE =
int8, PARALLEL = SAFE, INITCOND = '0');
+ERROR: CREATE SCHEMA ... CREATE AGGREGATE currently not supported
not all CI test machine encoding is UTF8, CREATE COLLATION depends on encoding,
if fail, error message may different on different machines, So we have to put
some of the tests to collate.icu.utf8.sql.
Please check the latest attached.
v7-0001-Don-t-try-to-re-order-the-subcommands-of-CREATE-SCHEMA.patch
v7-0002-CREATE-SCHEMA-CREATE-DOMAIN.patch
v7-0003-CREATE-SCHEMA-CREATE-COLLATION.patch
v7-0004-CREATE-SCHEMA-CREATE-TYPE.patch