|
50 | 50 | import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtractor;
|
51 | 51 | import org.hibernate.exception.spi.ViolatedConstraintNameExtractor;
|
52 | 52 | import org.hibernate.internal.util.JdbcExceptionHelper;
|
| 53 | +import org.hibernate.mapping.AggregateColumn; |
| 54 | +import org.hibernate.mapping.Table; |
53 | 55 | import org.hibernate.metamodel.mapping.EntityMappingType;
|
54 | 56 | import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
55 | 57 | import org.hibernate.persister.entity.mutation.EntityMutationTarget;
|
|
78 | 80 | import org.hibernate.sql.model.internal.OptionalTableUpdate;
|
79 | 81 | import org.hibernate.sql.model.jdbc.OptionalTableUpdateOperation;
|
80 | 82 | import org.hibernate.tool.schema.extract.spi.ColumnTypeInformation;
|
| 83 | +import org.hibernate.tool.schema.internal.StandardTableExporter; |
| 84 | +import org.hibernate.tool.schema.spi.Exporter; |
81 | 85 | import org.hibernate.type.JavaObjectType;
|
82 | 86 | import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
83 | 87 | import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
|
@@ -145,6 +149,17 @@ public class PostgreSQLDialect extends Dialect {
|
145 | 149 | protected final static DatabaseVersion MINIMUM_VERSION = DatabaseVersion.make( 12 );
|
146 | 150 |
|
147 | 151 | private final UniqueDelegate uniqueDelegate = new CreateTableUniqueDelegate(this);
|
| 152 | + private final StandardTableExporter postgresqlTableExporter = new StandardTableExporter( this ) { |
| 153 | + @Override |
| 154 | + protected void applyAggregateColumnCheck(StringBuilder buf, AggregateColumn aggregateColumn) { |
| 155 | + final JdbcType jdbcType = aggregateColumn.getType().getJdbcType(); |
| 156 | + if ( jdbcType.isXml() ) { |
| 157 | + // Requires the use of xmltable which is not supported in check constraints |
| 158 | + return; |
| 159 | + } |
| 160 | + super.applyAggregateColumnCheck( buf, aggregateColumn ); |
| 161 | + } |
| 162 | + }; |
148 | 163 |
|
149 | 164 | protected final PostgreSQLDriverKind driverKind;
|
150 | 165 | private final OptionalTableUpdateStrategy optionalTableUpdateStrategy;
|
@@ -1474,6 +1489,11 @@ public UniqueDelegate getUniqueDelegate() {
|
1474 | 1489 | return uniqueDelegate;
|
1475 | 1490 | }
|
1476 | 1491 |
|
| 1492 | + @Override |
| 1493 | + public Exporter<Table> getTableExporter() { |
| 1494 | + return postgresqlTableExporter; |
| 1495 | + } |
| 1496 | + |
1477 | 1497 | /**
|
1478 | 1498 | * @return {@code true}, but only because we can "batch" truncate
|
1479 | 1499 | */
|
|
0 commit comments