Repository: ent/ent

Issue:
Add new Postgres versions in integration tests
- [x] I have searched the [issues](https://github.com/ent/ent/issues) of this repository and believe that this is not a duplicate.

## Summary 💡

As [the docs](https://entgo.io/docs/dialects/#postgresql) say
> PostgreSQL supports all the features that are mentioned in the [Migration](https://entgo.io/docs/migrate) section, and **it's being tested constantly on the following 5 versions: 11, 12, 13, 14 and 15**.

And it can be seen [in the CI code](https://github.com/ent/ent/blob/master/entc/integration/docker-compose.yaml#L130) that indeed it's only testing up to 15.

PostgreSQL is up to major version 17 now, so it'd be great to capture the newer versions in the integration tests.

## Motivation 🔦

We can see that there have been issues:
* https://github.com/ent/ent/issues/3971

Which could have likely been caught with proactive testing in CI.

And for a personal motivation, we are a bit scared to upgrade our own Postgres cluster beyond 15 due to the lack of testing on later versions.

Discussion:
@masseelch: Hey! The issue you are mentioning are in regards to the (legacy) migration engine. Ent no longer has its own migration engine, but is relying on [Atlas](https://atlasgo.io) to manage migrations. Atlas of course has support for all suported Postgres versions. 

@masseelch: I did add integration testing for PG16 and PG17 for the dialect tests. Hopefully this can reduce your concerns 🙏 

Solution patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 2e7893487..5d317d0bb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -241,6 +241,30 @@ jobs:
           --health-interval 10s
           --health-timeout 5s
           --health-retries 5
+      postgres16:
+        image: postgres:16
+        env:
+          POSTGRES_DB: test
+          POSTGRES_PASSWORD: pass
+        ports:
+          - 5436:5432
+        options: >-
+          --health-cmd pg_isready
+          --health-interval 10s
+          --health-timeout 5s
+          --health-retries 5
+      postgres17:
+        image: postgres:17
+        env:
+          POSTGRES_DB: test
+          POSTGRES_PASSWORD: pass
+        ports:
+          - 5437:5432
+        options: >-
+          --health-cmd pg_isready
+          --health-interval 10s
+          --health-timeout 5s
+          --health-retries 5
       gremlin-server:
         image: entgo/gremlin-server
         ports:
@@ -419,6 +443,30 @@ jobs:
           --health-interval 10s
           --health-timeout 5s
           --health-retries 5
+      postgres16:
+        image: postgres:16
+        env:
+          POSTGRES_DB: test
+          POSTGRES_PASSWORD: pass
+        ports:
+          - 5436:5432
+        options: >-
+          --health-cmd pg_isready
+          --health-interval 10s
+          --health-timeout 5s
+          --health-retries 5
+      postgres17:
+        image: postgres:17
+        env:
+          POSTGRES_DB: test
+          POSTGRES_PASSWORD: pass
+        ports:
+          - 5437:5432
+        options: >-
+          --health-cmd pg_isready
+          --health-interval 10s
+          --health-timeout 5s
+          --health-retries 5
       gremlin-server:
         image: entgo/gremlin-server
         ports:
diff --git a/entc/integration/docker-compose.yaml b/entc/integration/docker-compose.yaml
index db0954243..32ac1af28 100644
--- a/entc/integration/docker-compose.yaml
+++ b/entc/integration/docker-compose.yaml
@@ -138,6 +138,28 @@ services:
     ports:
       - 5435:5432
 
+  postgres16:
+    platform: linux/amd64
+    image: postgres:16
+    environment:
+      POSTGRES_DB: test
+      POSTGRES_PASSWORD: pass
+    healthcheck:
+      test: pg_isready -U postgres
+    ports:
+      - 5436:5432
+
+  postgres17:
+    platform: linux/amd64
+    image: postgres:16
+    environment:
+      POSTGRES_DB: test
+      POSTGRES_PASSWORD: pass
+    healthcheck:
+      test: pg_isready -U postgres
+    ports:
+      - 5437:5432
+
   gremlin:
     platform: linux/amd64
     image: entgo/gremlin-server



Test patch:
diff --git a/entc/integration/integration_test.go b/entc/integration/integration_test.go
index 9a4a9b4e8..091c125ec 100644
--- a/entc/integration/integration_test.go
+++ b/entc/integration/integration_test.go
@@ -106,7 +106,16 @@ func TestMaria(t *testing.T) {
 }
 
 func TestPostgres(t *testing.T) {
-	for version, port := range map[string]int{"10": 5430, "11": 5431, "12": 5432, "13": 5433, "14": 5434, "15": 5435} {
+	for version, port := range map[string]int{
+		"10": 5430,
+		"11": 5431,
+		"12": 5432,
+		"13": 5433,
+		"14": 5434,
+		"15": 5435,
+		"16": 5436,
+		"17": 5437,
+	} {
 		addr := fmt.Sprintf("host=localhost port=%d user=postgres dbname=test password=pass sslmode=disable", port)
 		t.Run(version, func(t *testing.T) {
 			t.Parallel()