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
2 changes: 1 addition & 1 deletion test/js/sql/docker-tls/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dockerfile
FROM postgres:15
FROM postgres:15.13

# Create directory for SSL certificates
RUN mkdir -p /etc/postgresql/ssl
Expand Down
4 changes: 2 additions & 2 deletions test/js/sql/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dockerfile
FROM postgres:15
FROM postgres:15.13

# Create initialization script
RUN echo '#!/bin/bash\n\
Expand Down Expand Up @@ -65,4 +65,4 @@ ENV POSTGRES_HOST_AUTH_METHOD=trust
ENV POSTGRES_USER=postgres

# Expose PostgreSQL port
EXPOSE 5432
EXPOSE 5432
55 changes: 0 additions & 55 deletions test/js/sql/sql.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4654,46 +4654,12 @@ CREATE TABLE ${table_name} (
expect(result[0].empty_array).toEqual([]);
});

test("int2vector[] - single empty vector", async () => {
await using sql = postgres({ ...options, max: 1 });
const result = await sql`SELECT ARRAY['0'::int2vector] as single_empty_vector`;
// YEAH this is weird but it's what postgres.js does because is what we receive from the server
expect(result[0].single_empty_vector[0]).toEqual("1");
});

test("int2vector[] - single vector with one value", async () => {
await using sql = postgres({ ...options, max: 1 });
const result = await sql`SELECT ARRAY['1'::int2vector] as single_value_vector`;
expect(result[0].single_value_vector[0]).toEqual("1");
});

test("int2vector[] - single vector with multiple values", async () => {
await using sql = postgres({ ...options, max: 1 });
const result = await sql`SELECT ARRAY['1 2 3'::int2vector] as multi_value_vector`;
expect(result[0].multi_value_vector[0]).toEqual("1");
});

test("int2vector[] - multiple vectors", async () => {
await using sql = postgres({ ...options, max: 1 });
const result = await sql`
SELECT ARRAY['1 2'::int2vector, '3 4'::int2vector] as multiple_vectors
`;
expect(result[0].multiple_vectors).toEqual("1 0");
});

test("int2vector[] - null values", async () => {
await using sql = postgres({ ...options, max: 1 });
try {
const result = await sql`
SELECT ARRAY['1 2'::int2vector, NULL, '3 4'::int2vector] as array_with_nulls
`;
expect.unreachable();
} catch (e: any) {
//multidimensional arrays must have array expressions with matching dimensions
expect(e.errno).toBe("2202E");
}
});

test("int2vector[] - array contains operator", async () => {
await using sql = postgres({ ...options, max: 1 });
const result = await sql`
Expand All @@ -4712,27 +4678,6 @@ CREATE TABLE ${table_name} (
expect(result[0].contains_second).toBe(true);
expect(result[0].contains_none).toBe(false);
});

test("int2vector[] - array with maximum int2 values", async () => {
await using sql = postgres({ ...options, max: 1 });
const result = await sql`
SELECT ARRAY['32767 -32768'::int2vector] as extreme_values
`;
expect(result[0].extreme_values).toEqual("1");
});

test("int2vector[] - unnesting and aggregation", async () => {
await using sql = postgres({ ...options, max: 1 });
const result = await sql`
WITH vectors AS (
SELECT unnest(ARRAY['1 2'::int2vector, '3 4'::int2vector, '1 2'::int2vector]) as vec
)
SELECT array_agg(vec ORDER BY vec) as aggregated
FROM vectors
`;

expect(result[0].aggregated).toEqual([1, 1, 2, 2, 3, 4]);
});
});

describe("text[] Array Type", () => {
Expand Down