File tree Expand file tree Collapse file tree 3 files changed +20
-8
lines changed
internal/sql/adapter/postgres Expand file tree Collapse file tree 3 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 1010 runs-on : ubuntu-latest
1111 services :
1212 postgres :
13- image : docker.io/library/postgres:16.4
13+ image : docker.io/library/postgres:18
1414 env :
1515 POSTGRES_PASSWORD : " "
1616 POSTGRES_HOST_AUTH_METHOD : trust
@@ -23,10 +23,10 @@ jobs:
2323 --health-retries 5
2424
2525 steps :
26- - uses : actions/checkout@v3
27- - uses : extractions/setup-just@v2
28- - uses : actions/setup-go@v5
26+ - uses : actions/checkout@v5
27+ - uses : extractions/setup-just@v4
28+ - uses : actions/setup-go@v6
2929 with :
30- go-version : ' ^1.24 '
30+ go-version : ' ^1.25 '
3131
3232 - run : just test-race
Original file line number Diff line number Diff line change 11services :
22 postgres :
3- image : docker.io/library/postgres:16
3+ image : docker.io/library/postgres:18
44 environment :
55 POSTGRES_PASSWORD : " "
66 POSTGRES_HOST_AUTH_METHOD : trust
Original file line number Diff line number Diff line change @@ -106,7 +106,12 @@ ORDER BY conrelid::regclass::text, contype DESC;
106106 for _ , idxSchema := range indexList {
107107 t := cat .Table (idxSchema .TABLE_NAME )
108108
109- t .(sqlbuilder.KeyCollectionManager ).AddKey (idxSchema .ToKey (t ))
109+ key := idxSchema .ToKey (t )
110+ if key == nil {
111+ continue
112+ }
113+
114+ t .(sqlbuilder.KeyCollectionManager ).AddKey (key )
110115 }
111116 }
112117
@@ -185,6 +190,13 @@ func (indexSchema) TableName() string {
185190}
186191
187192func (idxSchema * indexSchema ) ToKey (table sqlbuilder.Table ) sqlbuilder.Key {
193+ // ignore pg 18 not_null indexes
194+ // https://www.enterprisedb.com/blog/changes-not-null-postgres-18?utm_source=chatgpt.com
195+ // https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-NOT-NULL
196+ if strings .HasPrefix (idxSchema .INDEX_DEF , "NOT NULL " ) {
197+ return nil
198+ }
199+
188200 isUnique := strings .Contains (idxSchema .INDEX_DEF , "UNIQUE" )
189201 method := ""
190202 name := ""
@@ -197,9 +209,9 @@ func (idxSchema *indexSchema) ToKey(table sqlbuilder.Table) sqlbuilder.Key {
197209 name = "PRIMARY"
198210 colParts = idxSchema .INDEX_DEF [len ("PRIMARY KEY" ):]
199211 } else {
212+ // USING <method> (f_col_1,f_col_2)
200213 name = strings .ToLower (idxSchema .INDEX_NAME [len (table .TableName ())+ 1 :])
201214 method = strings .ToUpper (reUsing .FindString (idxSchema .INDEX_DEF )[6 :])
202- // USING
203215 colParts = strings .TrimSpace (reUsing .Split (idxSchema .INDEX_DEF , 2 )[1 ])
204216 }
205217
You can’t perform that action at this time.
0 commit comments