Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vfxpJ-006XAf-08 for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jan 2026 10:10:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vfxpI-009YxA-0h for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Jan 2026 10:10:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vfxpH-009Yx0-2Q for pgsql-hackers@lists.postgresql.org; Wed, 14 Jan 2026 10:10:08 +0000 Received: from udcm-wwu2.uni-muenster.de ([128.176.118.28]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vfxpE-000MHq-0l for pgsql-hackers@lists.postgresql.org; Wed, 14 Jan 2026 10:10:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=uni-muenster.de; i=@uni-muenster.de; q=dns/txt; s=uniout; t=1768385405; x=1799921405; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=Ca1yWK6ljorhPjN6t04GV4PCxZQ/qM2yM/hPYMAPA4w=; b=NaoI5Oe+abGCHYTZfHtfveGkJ30rlUJpMXGll/M/2sIY/Re6Od0f4qZW Rv++az/t8FTciIRV1BPYk8++l7cRqQG1GUea2/9h+FoKDC4urrN4uyg1w S4lMtKI+YiN3KSYCZOQRqk92GG9QH4T+lSEn8Lb3ruNcH45bnpPJoE0yQ E9HdOZ3seuLiP4yvxc6Zxb2xmxSCKBRbUALT7qmOL9i59yIBJUSCqSik8 /46YbAHfjxLU+VELrSnyjQ4nE6SOdt/9i0GXjd/XZqW10mC9dTBCoKbfz XRWra4ro5tCnRxTkSXdxOxBO8I2T7kyjSWUB7lWGhEe/oMzQoNoVwlgVD g==; X-CSE-ConnectionGUID: xrkZ2iW5SXuYuwGLYRYBDQ== X-CSE-MsgGUID: A9yIOnvSQW2bJZLRyqTpTg== X-IronPort-AV: E=Sophos;i="6.21,225,1763420400"; d="scan'208";a="380995523" Received: from secmail.uni-muenster.de ([128.176.118.4]) by UDCM-RELAY2.UNI-MUENSTER.DE with ESMTP; 14 Jan 2026 11:10:01 +0100 Received: from [192.168.178.27] (dynamic-077-177-150-029.77.177.pool.telefonica.de [77.177.150.29]) by SECMAIL.UNI-MUENSTER.DE (Postfix) with ESMTPSA id 4FC1720ADF02; Wed, 14 Jan 2026 11:10:00 +0100 (CET) Message-ID: <2898f090-d9cf-475c-940c-a99da4a308f1@uni-muenster.de> Date: Wed, 14 Jan 2026 11:09:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: WIP - xmlvalidate implementation from TODO list To: Marcos Magueta Cc: Andrey Borodin , Kirill Reshke , PostgreSQL Hackers References: <89DE974B-F318-4D0A-A60B-51EDE84054E2@gmail.com> <9A074422-2308-4BD0-9FFA-0B6D70989935@yandex-team.ru> <70c72cb1-a39f-41b3-bfe3-e32ee7fda9c4@uni-muenster.de> <68a012d3-121b-418a-913b-aa0aaf32915d@uni-muenster.de> Content-Language: de-DE, en-GB From: Jim Jones In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 14/01/2026 02:23, Marcos Magueta wrote: > Please follow the updated version attached. A few comments: == grammar == In gram.y you restricted CREATE XMLSCHEMA to Sconst: DO $$ DECLARE xsd text := ''; BEGIN CREATE XMLSCHEMA person_schema AS xsd; END $$; ERROR: syntax error at or near "xsd" LINE 4: CREATE XMLSCHEMA person_schema AS xsd; Any particular reason for that? If not, take a look at other options, e.g. a_expr == pg_xmlschema == Why did you choose text over xml for schemadata? postgres=# \d pg_xmlschema Table "pg_catalog.pg_xmlschema" Column | Type | Collation | Nullable | Default -----------------+-----------+-----------+----------+--------- oid | oid | | not null | schemaname | name | | not null | schemanamespace | oid | | not null | schemaowner | oid | | not null | schemadata | text | C | not null | schemaacl | aclitem[] | | | Indexes: "pg_xmlschema_oid_index" PRIMARY KEY, btree (oid) "pg_xmlschema_name_nsp_index" UNIQUE CONSTRAINT, btree (schemaname, schemanamespace) == psql command to display and list xml schemas == Not a requirement for this patch (specially not at the current stage), but you should add it to your TODO list. \dz \dz foo \dz+ foo * z here is just an example == tab completion == CREATE should suggest XMLSCHEMA and CREATE XML should autocomplete CREATE XMLSCHEMA. The same applies for DROP XMLSCHEMA [IF EXISTS], where it should additionally list the available schemas after DROP XMLSCHEMA . == white-space warnings == The patch does not apply cleanly: /home/jim/patches/xmlvalidate/0002-xmlschema-catalog-and-xmlvalidate.patch:594: indent with spaces. Oid schemanamespace, /home/jim/patches/xmlvalidate/0002-xmlschema-catalog-and-xmlvalidate.patch:595: indent with spaces. Oid schemaowner, /home/jim/patches/xmlvalidate/0002-xmlschema-catalog-and-xmlvalidate.patch:596: indent with spaces. const char *schemadata, /home/jim/patches/xmlvalidate/0002-xmlschema-catalog-and-xmlvalidate.patch:597: indent with spaces. bool if_not_exists, /home/jim/patches/xmlvalidate/0002-xmlschema-catalog-and-xmlvalidate.patch:598: indent with spaces. bool quiet) warning: squelched 139 whitespace errors warning: 144 lines add whitespace errors. == file naming == Your patch suggests that it is part of a patch set, from which 0001 is missing. In case you meant a version 2 of the previous patch, a better format would be v2-0001-xmlschema-catalog-and-xmlvalidate.patch which can be generated with $ git format-patch -1 -v2 == xml_1.out not updated == After every change in xml.sql you must create an equivalent file for a postgres compiled without --with-libxml, and put the changes in xml_1.out.[1] == corrupt pg_dump == I understand we agreed to work on XMLVALIDATE only after CREATE XMLSCHEMA is settled, but since the code is partially already there, you might wanna take a look at pg_dump. It is not serialising the CREATE XMLSCHEMA statements: $ /usr/local/postgres-dev/bin/psql postgres psql (19devel) Type "help" for help. postgres=# CREATE XMLSCHEMA person_schema AS ' '; CREATE XMLSCHEMA postgres=# CREATE VIEW v AS SELECT XMLVALIDATE(DOCUMENT ''::xml ACCORDING TO XMLSCHEMA person_schema); CREATE VIEW postgres=# \q $ /usr/local/postgres-dev/bin/pg_dump postgres -- -- PostgreSQL database dump -- \restrict WLaIQWmNJVW2yc4Jv5W81qh2TZGHnupJlpl4Urm4Pp6Ku3VPyH5dO3ReFc4LMmd -- Dumped from database version 19devel -- Dumped by pg_dump version 19devel SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET transaction_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', false); SET check_function_bodies = false; SET xmloption = content; SET client_min_messages = warning; SET row_security = off; -- -- Name: test_xmlschema_ns; Type: SCHEMA; Schema: -; Owner: jim -- CREATE SCHEMA test_xmlschema_ns; ALTER SCHEMA test_xmlschema_ns OWNER TO jim; -- -- Name: v; Type: VIEW; Schema: public; Owner: jim -- CREATE VIEW public.v AS SELECT XMLVALIDATE(DOCUMENT ''::xml ACCORDING TO XMLSCHEMA person_schema) AS "xmlvalidate"; ALTER VIEW public.v OWNER TO jim; -- -- PostgreSQL database dump complete -- \unrestrict WLaIQWmNJVW2yc4Jv5W81qh2TZGHnupJlpl4Urm4Pp6Ku3VPyH5dO3ReFc4LMmd Take a look at pg_dump.c. You might need a new function, e.g. dumpXmlSchemas(Archive *fout, const SchemaInfo *schemaInfo) == patch structure == To make the review a bit easier, I suggest to split this patch into a patch set with **at least 4** smaller patches - the more seasoned hackers here might correct me if I am wrong. For instance: 0001 - CREATE XMLSCHEMA (code + tests + documentation) 0002 - pg_dump changes to output CREATE XMLSCHEMA 0003 - psql tab completion + new command to display and list xml schemas 0004 - XMLVALIDATE (code + tests + documentation) Thanks for working on this! Best, Jim [1] https://cirrus-ci.com/task/4872456290172928?logs=check_world#L126