Skip to content

Commit 0e56a82

Browse files
authored
Fixed check constraint on postgresql 17 (#84)
1 parent 8851961 commit 0e56a82

4 files changed

Lines changed: 18 additions & 5 deletions

File tree

Changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.108] - 2025-06-26
8+
### Fixed
9+
- check constraints on postgresql 17
10+
11+
## [1.107] - 2025-02-21
12+
### Changed
13+
- using yaml on views, procedures and triggers
14+
715
## [1.106] - 2025-02-03
816
### Added
917
- FAIL_ON_WARNINIG environment variable

bee.spec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Summary: Bluesoft bee
22
Name: bee
3-
Version: 1.106
3+
Version: 1.107
44
Release: %(perl -e 'print time()')
55
BuildArch: noarch
66
AutoReq: no
@@ -29,6 +29,7 @@ wget -P %{installdir}/ https://github.com/bluesoft/bee/releases/download/%{versi
2929
unzip -d %{installdir}/ %{installdir}/bee-%{version}.zip
3030
wget -P %{installdir}/bee-%{version}/lib/ https://s3-sa-east-1.amazonaws.com/bluesoft-sp/install/oracle/ojdbc6-11.2.0.4.0.jar
3131
wget -P %{installdir}/bee-%{version}/lib/ https://s3-sa-east-1.amazonaws.com/bluesoft-sp/install/postgres/postgresql-42.7.4.jar
32+
wget -P %{installdir}/bee-%{version}/lib/ https://s3.amazonaws.com/redshift-downloads/drivers/jdbc/2.1.0.33/redshift-jdbc42-2.1.0.33.jar
3233
wget -P %{installdir}/bee-%{version}/lib/ https://github.com/awslabs/aws-mysql-jdbc/releases/download/1.1.5/aws-mysql-jdbc-1.1.5.jar
3334

3435
%clean

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mainClassName = "br.com.bluesoft.bee.Bee"
1616

1717
group = 'br.com.bluesoft.bee'
1818
def artifact = 'bee'
19-
version = '1.107'
19+
version = '1.108'
2020

2121
def javaVersion = JavaVersion.VERSION_1_8
2222
sourceCompatibility = javaVersion;

src/main/groovy/br/com/bluesoft/bee/database/reader/PostgresDatabaseReader.groovy

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class PostgresDatabaseReader implements DatabaseReader {
8383
def tables = fillTables(objectName)
8484
fillColumns(tables, objectName)
8585
fillIndexes(tables, objectName, databaseVersion)
86-
fillCostraints(tables, objectName)
86+
fillCostraints(tables, objectName, databaseVersion)
8787
fillCostraintsColumns(tables, objectName)
8888
return tables
8989
}
@@ -329,7 +329,7 @@ class PostgresDatabaseReader implements DatabaseReader {
329329
order by tc.table_name, tc.constraint_type, tc.constraint_name
330330
'''
331331

332-
private def fillCostraints(tables, objectName) {
332+
private def fillCostraints(tables, objectName, databaseVersion) {
333333
def rows
334334
if (objectName) {
335335
rows = sql.rows(CONSTRAINTS_QUERY_BY_NAME, [objectName])
@@ -351,7 +351,11 @@ class PostgresDatabaseReader implements DatabaseReader {
351351
constraint.status = status
352352
if (constraint.type == 'C') {
353353
constraint.refTable = null
354-
constraint.searchCondition = it.check_clause[2..-3]
354+
if (databaseVersion && Float.parseFloat(databaseVersion) >= 17) {
355+
constraint.searchCondition = it.check_clause[1..-2]
356+
} else {
357+
constraint.searchCondition = it.check_clause[2..-3]
358+
}
355359
}
356360

357361
table.constraints[constraint.name] = constraint

0 commit comments

Comments
 (0)