Home Explore Blog CI



postgresql

17th chunk of `doc/src/sgml/release-18.sgml`
ec1d851ca46e13ed7cc85a8b3fb4b238afeb6765052d84a90000000100000fb0

</para>

<para>
This also adds column pg_constraint.conenforced.
</para>
</listitem>

<!--
Author: Peter Eisentraut <peter@eisentraut.org>
2024-11-15 [9321d2fdf] Fix collation handling for foreign keys
-->

<listitem>
<para>
Require primary/foreign key relationships to use either deterministic collations or the the same nondeterministic collations (Peter Eisentraut)
<ulink url="&commit_baseurl;9321d2fdf">&sect;</ulink>
</para>

<para>
The restore of a pg_dump, also used by pg_upgrade, will fail if these requirements are not met;  schema changes must be made for these upgrade methods to succeed.
</para>
</listitem>

<!--
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
2024-11-08 [14e87ffa5] Add pg_constraint rows for not-null constraints
-->

<listitem>
<para>
Store column NOT NULL specifications in pg_constraint (Álvaro Herrera, Bernd Helmle)
<ulink url="&commit_baseurl;14e87ffa5">&sect;</ulink>
</para>

<para>
This allows names to be specified for NOT NULL constraint.  This also adds NOT NULL constraints to foreign tables and NOT NULL inheritance control to local tables.
</para>
</listitem>

<!--
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
2025-04-07 [a379061a2] Allow NOT NULL constraints to be added as NOT VALID
-->

<listitem>
<para>
Allow ALTER TABLE to set the NOT VALID attribute of NOT NULL constraints (Rushabh Lathia, Jian He)
<ulink url="&commit_baseurl;a379061a2">&sect;</ulink>
</para>
</listitem>

<!--
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
2025-03-05 [f4e53e10b] Add ALTER TABLE ... ALTER CONSTRAINT ... SET [NO] INHERI
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
2025-03-27 [4a02af8b1] Simplify syntax for ALTER TABLE ALTER CONSTRAINT NO INHE
-->

<listitem>
<para>
Allow modification of the inheritability of NOT NULL constraints (Suraj Kharage, Álvaro Herrera)
<ulink url="&commit_baseurl;f4e53e10b">&sect;</ulink>
<ulink url="&commit_baseurl;4a02af8b1">&sect;</ulink>
</para>

<para>
The syntax is ALTER TABLE ... ALTER CONSTRAINT ... [NO] INHERIT.
</para>
</listitem>

<!--
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
2025-01-23 [b663b9436] Allow NOT VALID foreign key constraints on partitioned t
-->

<listitem>
<para>
Allow NOT VALID foreign key constraints on partitioned tables (Amul Sul)
<ulink url="&commit_baseurl;b663b9436">&sect;</ulink>
</para>
</listitem>

<!--
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
2024-09-30 [4dea33ce7] Don't disallow DROP of constraints ONLY on partitioned t
-->

<listitem>
<para>
Allow dropping of constraints ONLY on partitioned tables (Álvaro Herrera)
<ulink url="&commit_baseurl;4dea33ce7">&sect;</ulink>
</para>

<para>
This was previously erroneously prohibited.
</para>
</listitem>

      </itemizedlist>
    </sect4>

    <sect4 id="release-18-copy">
     <title><link linkend="sql-copy"><command>COPY</command></link></title>

      <itemizedlist>

<!--
Author: Fujii Masao <fujii@postgresql.org>
2024-10-08 [4ac2a9bec] Add REJECT_LIMIT option to the COPY command.
-->

<listitem>
<para>
Add REJECT_LIMIT to control the number of invalid rows COPY FROM can ignore (Atsushi Torikoshi)
<ulink url="&commit_baseurl;4ac2a9bec">&sect;</ulink>
</para>

<para>
This is available when ON_ERROR = 'ignore'.
</para>
</listitem>

<!--
Author: Fujii Masao <fujii@postgresql.org>
2025-04-04 [534874fac] Allow "COPY table TO" command to copy rows from material
-->

<listitem>
<para>
Allow COPY TO to copy rows from populated materialized view (Jian He)
<ulink url="&commit_baseurl;534874fac">&sect;</ulink>
</para>
</listitem>

<!--
Author: Fujii Masao <fujii@postgresql.org>
2024-10-03 [e7834a1a2] Add LOG_VERBOSITY = 'silent' support to COPY command.
-->

<listitem>
<para>
Add COPY LOG_VERBOSITY level "silent" to suppress log output of ignored rows (Atsushi Torikoshi)
<ulink url="&commit_baseurl;e7834a1a2">&sect;</ulink>
</para>

<para>
This new level suppresses output for discarded input rows when on_error = 'ignore'.
</para>
</listitem>

<!--
Author: Nathan Bossart <nathan@postgresql.org>

Title: PostgreSQL 18: Constraint Enhancements and COPY Command Updates
Summary
This section details enhancements to constraints, including storing NOT NULL specifications in pg_constraint, allowing ALTER TABLE to set the NOT VALID attribute of NOT NULL constraints, modifying the inheritability of NOT NULL constraints, allowing NOT VALID foreign key constraints on partitioned tables, and allowing dropping of constraints ONLY on partitioned tables. It also covers updates to the COPY command, such as adding REJECT_LIMIT to control the number of invalid rows COPY FROM can ignore, allowing COPY TO to copy rows from populated materialized views, and adding COPY LOG_VERBOSITY level 'silent' to suppress log output of ignored rows.