Skip to content

Commit d8734fb

Browse files
authored
Merge pull request #892 from supabase/avallete/fix-indexes-array-results
fix(indexes): fields vector to array
2 parents b85bf01 + dbe8d2b commit d8734fb

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

src/lib/sql/indexes.sql

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ SELECT
1414
idx.indisready AS is_ready,
1515
idx.indislive AS is_live,
1616
idx.indisreplident AS is_replica_identity,
17-
idx.indkey AS key_attributes,
18-
idx.indcollation AS collation,
19-
idx.indclass AS class,
20-
idx.indoption AS options,
17+
idx.indkey::smallint[] AS key_attributes,
18+
idx.indcollation::integer[] AS collation,
19+
idx.indclass::integer[] AS class,
20+
idx.indoption::smallint[] AS options,
2121
idx.indpred AS index_predicate,
2222
obj_description(idx.indexrelid, 'pg_class') AS comment,
2323
ix.indexdef as index_definition,

test/server/indexes.ts

+24-8
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ test('list indexes', async () => {
1515
{
1616
"access_method": "btree",
1717
"check_xmin": false,
18-
"class": "3124",
19-
"collation": "0",
18+
"class": [
19+
3124,
20+
],
21+
"collation": [
22+
0,
23+
],
2024
"comment": null,
2125
"id": 16399,
2226
"index_attributes": [
@@ -37,10 +41,14 @@ test('list indexes', async () => {
3741
"is_replica_identity": false,
3842
"is_unique": true,
3943
"is_valid": true,
40-
"key_attributes": "1",
44+
"key_attributes": [
45+
1,
46+
],
4147
"number_of_attributes": 1,
4248
"number_of_key_attributes": 1,
43-
"options": "0",
49+
"options": [
50+
0,
51+
],
4452
"schema": "public",
4553
"table_id": 16393,
4654
}
@@ -56,8 +64,12 @@ test('retrieve index', async () => {
5664
{
5765
"access_method": "btree",
5866
"check_xmin": false,
59-
"class": "3124",
60-
"collation": "0",
67+
"class": [
68+
3124,
69+
],
70+
"collation": [
71+
0,
72+
],
6173
"comment": null,
6274
"id": 16399,
6375
"index_attributes": [
@@ -78,10 +90,14 @@ test('retrieve index', async () => {
7890
"is_replica_identity": false,
7991
"is_unique": true,
8092
"is_valid": true,
81-
"key_attributes": "1",
93+
"key_attributes": [
94+
1,
95+
],
8296
"number_of_attributes": 1,
8397
"number_of_key_attributes": 1,
84-
"options": "0",
98+
"options": [
99+
0,
100+
],
85101
"schema": "public",
86102
"table_id": 16393,
87103
}

0 commit comments

Comments
 (0)