diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index e86d57304..e53f4c538 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -8,6 +8,10 @@ env: GO_VERSION: 1.19 CGO_ENABLED: 0 +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: tests: name: tests @@ -15,7 +19,7 @@ jobs: timeout-minutes: 30 strategy: matrix: - pg_version: [12, 13, 14] + pg_version: [9.6, 10, 11, 12, 13, 14, 15] services: postgres: @@ -32,6 +36,13 @@ jobs: --health-timeout 5s --health-retries 5 steps: + - name: Install latest Postgres client + run: | + sudo rm -f /etc/apt/sources.list.d/pgdg.list + curl --silent https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add + echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list + sudo apt-get update && sudo apt-get install -y postgresql-client-15 + - uses: actions/checkout@v3 with: fetch-depth: 0 diff --git a/data/booktown.sql b/data/booktown.sql index aecccac6c..a7345f2be 100644 --- a/data/booktown.sql +++ b/data/booktown.sql @@ -10,7 +10,7 @@ DROP DATABASE IF EXISTS "booktown"; CREATE DATABASE "booktown"; -\connect booktown postgres +-- \connect booktown postgres -- -- TOC Entry ID 2 (OID 2991542) -- @@ -1293,7 +1293,7 @@ CREATE VIEW "recent_shipments" as SELECT count(*) AS num_shipped, max(shipments. COPY "publishers" FROM stdin; -150 Kids Can Press Kids Can Press, 29 Birch Ave. Toronto, ON  M4V 1E2 +150 Kids Can Press Kids Can Press, 29 Birch Ave. Toronto,�ON��M4V 1E2 91 Henry Holt & Company, Inc. Henry Holt & Company, Inc. 115 West 18th Street New York, NY 10011 113 O'Reilly & Associates O'Reilly & Associates, Inc. 101 Morris St, Sebastopol, CA 95472 62 Watson-Guptill Publications 1515 Boradway, New York, NY 10036 diff --git a/docker-compose-pg.yml b/docker-compose-pg.yml new file mode 100644 index 000000000..c07f9d018 --- /dev/null +++ b/docker-compose-pg.yml @@ -0,0 +1,48 @@ +--- +version: "3.9" + +x-base: &base + environment: &env + POSTGRES_DB: pgweb + POSTGRES_PASSWORD: pgweb + POSTGRES_USER: pgweb + healthcheck: + test: pg_isready -U pgweb -h 127.0.0.1 + interval: 5s + +services: + postgres15: + <<: *base + image: postgres:15 + ports: + - 5433:5432 + postgres14: + <<: *base + image: postgres:14 + ports: + - 5434:5432 + postgres13: + <<: *base + image: postgres:13 + ports: + - 5435:5432 + postgres12: + <<: *base + image: postgres:12 + ports: + - 5436:5432 + postgres11: + <<: *base + image: postgres:11 + ports: + - 5437:5432 + postgres10: + <<: *base + image: postgres:10 + ports: + - 5438:5432 + postgres9.6: + <<: *base + image: postgres:9.6 + ports: + - 5439:5432 diff --git a/pkg/client/client_test.go b/pkg/client/client_test.go index 7072b9f39..252c4db25 100644 --- a/pkg/client/client_test.go +++ b/pkg/client/client_test.go @@ -7,6 +7,7 @@ import ( "os/exec" "runtime" "sort" + "strings" "testing" "time" @@ -143,7 +144,7 @@ func teardownClient() { } } -func teardown() { +func teardown(t *testing.T, allowFail bool) { output, err := exec.Command( testCommands["dropdb"], "-U", serverUser, @@ -152,9 +153,13 @@ func teardown() { serverDatabase, ).CombinedOutput() - if err != nil { - fmt.Println("Teardown error:", err) - fmt.Printf("%s\n", output) + if err != nil && strings.Contains(err.Error(), "does not exist") { + t.Log("Teardown error:", err) + t.Logf("%s\n", output) + + if !allowFail { + assert.NoError(t, err) + } } } @@ -602,7 +607,7 @@ func TestAll(t *testing.T) { initVars() setupCommands() - teardown() + teardown(t, false) setup() setupClient() @@ -632,5 +637,5 @@ func TestAll(t *testing.T) { testDumpExport(t) teardownClient() - teardown() + teardown(t, true) } diff --git a/pkg/statements/sql/function.sql b/pkg/statements/sql/function.sql index 4eede756d..b2473b806 100644 --- a/pkg/statements/sql/function.sql +++ b/pkg/statements/sql/function.sql @@ -1,5 +1,8 @@ SELECT - p.*, + p.oid, + p.proname, + p.pronamespace, + p.proowner, pg_get_functiondef(oid) AS functiondef FROM pg_catalog.pg_proc p diff --git a/pkg/statements/sql/objects.sql b/pkg/statements/sql/objects.sql index 43e73d6a6..d9707109c 100644 --- a/pkg/statements/sql/objects.sql +++ b/pkg/statements/sql/objects.sql @@ -40,7 +40,6 @@ WITH all_objects AS ( WHERE n.nspname !~ '^pg_toast' AND n.nspname NOT IN ('information_schema', 'pg_catalog') - AND p.prokind = 'f' ) SELECT * FROM all_objects ORDER BY 1, 2