Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ jobs:
./ci/scripts/cpp_test.sh "$(pwd)/build"
./ci/scripts/python_test.sh "$(pwd)" "$(pwd)/build"
docker compose down
- name: Install pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659 # v0.8.1
with:
pixi-version: v0.62.1
- name: Run PostgreSQL Validation Suite
run: |
env POSTGRES_VERSION=15 docker compose up --wait --detach postgres-test
cd c/driver/postgresql/validation
pixi run validate
docker compose down
- name: Test PostgreSQL Driver - postgres 16
env:
BUILD_ALL: "0"
Expand Down
4 changes: 2 additions & 2 deletions c/driver/postgresql/connection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,10 @@ AdbcStatusCode PostgresConnection::GetInfo(struct AdbcConnection* connection,
break;
case ADBC_INFO_DRIVER_VERSION:
// TODO(lidavidm): fill in driver version
infos.push_back({info_codes[i], "(unknown)"});
infos.push_back({info_codes[i], "unknown"});
break;
case ADBC_INFO_DRIVER_ARROW_VERSION:
infos.push_back({info_codes[i], NANOARROW_VERSION});
infos.push_back({info_codes[i], "v" NANOARROW_VERSION});
break;
case ADBC_INFO_DRIVER_ADBC_VERSION:
infos.push_back({info_codes[i], ADBC_VERSION_1_1_0});
Expand Down
4 changes: 2 additions & 2 deletions c/driver/postgresql/postgresql_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class PostgresQuirks : public adbc_validation::DriverQuirks {
case ADBC_INFO_DRIVER_NAME:
return "ADBC PostgreSQL Driver";
case ADBC_INFO_DRIVER_VERSION:
return "(unknown)";
return "unknown";
case ADBC_INFO_VENDOR_NAME:
return "PostgreSQL";
default:
Expand Down Expand Up @@ -291,7 +291,7 @@ TEST_F(PostgresConnectionTest, GetInfoMetadata) {
}
case ADBC_INFO_DRIVER_VERSION: {
ArrowStringView val = ArrowArrayViewGetStringUnsafe(str_child, offset);
EXPECT_EQ("(unknown)", std::string(val.data, val.size_bytes));
EXPECT_EQ("unknown", std::string(val.data, val.size_bytes));
break;
}
case ADBC_INFO_VENDOR_NAME: {
Expand Down
10 changes: 6 additions & 4 deletions c/driver/postgresql/result_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,16 @@ Status PqResultHelper::ResolveParamTypes(PostgresTypeResolver& type_resolver,
const Oid pg_oid = PQparamtype(result_, i);
PostgresType pg_type;
if (type_resolver.Find(pg_oid, &pg_type, &na_error) != NANOARROW_OK) {
Status status = Status::NotImplemented("[libpq] Parameter #", i + 1, " (\"",
PQfname(result_, i),
"\") has unknown type code ", pg_oid);
std::string param_name = "$" + std::to_string(i + 1);
Status status =
Status::NotImplemented("[libpq] Parameter #", i + 1, " (\"", param_name,
"\") has unknown type code ", pg_oid);
ClearResult();
return status;
}

root_type.AppendChild(PQfname(result_, i), pg_type);
std::string param_name = "$" + std::to_string(i + 1);
root_type.AppendChild(param_name.c_str(), pg_type);
}

*param_types = root_type;
Expand Down
18 changes: 18 additions & 0 deletions c/driver/postgresql/validation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

validation-report.xml
59 changes: 59 additions & 0 deletions c/driver/postgresql/validation/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# PostgreSQL ADBC Driver Validation Suite

This directory contains a Python-based validation suite for the PostgreSQL ADBC driver.

## Testing

A running instance of PostgreSQL is required. For example, using Docker:

```shell
$ docker run -it --rm \
-e POSTGRES_PASSWORD=password \
-e POSTGRES_DB=postgres \
-p 5432:5432 \
postgres
```

Alternatively use the `docker compose` provided by ADBC to manage the test
database container.

```shell
$ docker compose up postgres-test
# When finished:
# docker compose down postgres-test
```

Then, to run the tests, set the environment variable specifying the
PostgreSQL URI before running tests:

```shell
$ export ADBC_POSTGRESQL_TEST_URI=postgresql://localhost:5432/postgres?user=postgres&password=password
```

### 5. Run Tests

#### Using pixi:

```bash
cd c/driver/postgresql/validation
pixi run validate
```
Loading
Loading