Skip to content

Commit 6ed48c0

Browse files
committed
test querying with tz in postgreSQL
1 parent 3afc2b3 commit 6ed48c0

File tree

5 files changed

+166
-83
lines changed

5 files changed

+166
-83
lines changed

.github/workflows/test.yml

+9
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ jobs:
1818
ACCEPT_EULA: Y
1919
SA_PASSWORD: My@Test@Password1
2020

21+
postgres:
22+
image: postgres:13
23+
ports:
24+
- "5432:5432"
25+
env:
26+
POSTGRES_DB: test
27+
POSTGRES_USER: test
28+
POSTGRES_PASSWORD: test
29+
2130
steps:
2231
- name: Checkout
2332
uses: actions/checkout@v2

docker-compose.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ services:
99
- MSSQL_SA_PASSWORD=My@Test@Password1
1010
command: ["/opt/mssql/bin/sqlservr", "--accept-eula", "--reset-sa-password"]
1111

12+
postgres:
13+
image: postgres:13
14+
ports:
15+
- "5432:5432"
16+
environment:
17+
POSTGRES_DB: test
18+
POSTGRES_USER: test
19+
POSTGRES_PASSWORD: test
20+
1221
dev:
1322
build: docker/dev
1423
volumes:
@@ -17,5 +26,5 @@ services:
1726
# Overrides default command so things don't shut down after the process ends.
1827
command: sleep infinity
1928

20-
# Runs app on the same network as the database container, allows "forwardPorts" in devcontainer.json function.
21-
network_mode: service:mssql
29+
# Allows accessing dbs through the port forwardings. dev container behaves like host for networking
30+
network_mode: host

docker/dev/Dockerfile

+10-5
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ RUN curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
1010
RUN curl https://packages.microsoft.com/config/debian/10/prod.list > /etc/apt/sources.list.d/mssql-release.list
1111
RUN echo msodbcsql17 msodbcsql/ACCEPT_EULA boolean true | debconf-set-selections
1212

13-
# [Optional] Uncomment this section to install additional packages.
13+
# This section install additional components
1414
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
15-
&& apt-get -y install --no-install-recommends \
16-
build-essential \
17-
unixodbc-dev \
18-
msodbcsql17
15+
&& apt-get -y install --no-install-recommends \
16+
build-essential \
17+
unixodbc-dev \
18+
msodbcsql17 \
19+
odbc-postgresql
20+
21+
# Fix PostgreSQL driver paths
22+
RUN sed --in-place 's/psqlodbca.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/psqlodbca.so/' /etc/odbcinst.ini
23+
RUN sed --in-place 's/psqlodbcw.so/\/usr\/lib\/x86_64-linux-gnu\/odbc\/psqlodbcw.so/' /etc/odbcinst.ini
1924

2025
# Setup cargo and install cargo packages required for tests
2126
USER vscode

src/query/strategy.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::convert::TryInto;
22

33
use anyhow::Error;
4-
use log::{debug, warn};
4+
use log::{debug, info, warn};
55
use odbc_api::{
66
buffers::{AnyColumnView, BufferDescription, BufferKind},
77
sys::SqlDataType,
@@ -143,6 +143,7 @@ pub fn strategy_from_column_description(
143143
if db_name == "Microsoft SQL Server" {
144144
// -155 is an indication for "Timestamp with timezone" on Microsoft SQL Server. We
145145
// give it special treatment so users can sort by time instead lexographically.
146+
info!("Detected Timestamp type with time zone. Appyling instant semantics for column {}.", cd.name_to_string()?);
146147
timestamp_tz(precision.try_into().unwrap(), repetition)?
147148
} else {
148149
unknown_non_char_type(cd, cursor, index, repetition)?

0 commit comments

Comments
 (0)