Fix Postgres uuid/text type mismatch in connection queries
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / test-frontend (pull_request) Successful in 6s
CI/CD / test-go-pg (pull_request) Successful in 2m48s
CI/CD / test-sqlite (pull_request) Successful in 2m53s
CI/CD / build-and-deploy (pull_request) Successful in 1m42s

ListAccessible, Resolve, and ResolveAll queries compare text user_id
parameter against team_members.user_id (uuid column), causing:
  pq: operator does not exist: uuid = text

Cast $N::uuid for the team_members subquery and team_id::text for the
owner_id comparison (ext_connections.owner_id is text).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-02 12:01:56 +00:00
parent 6ebffc1078
commit e77ab91e17

View File

@@ -82,7 +82,7 @@ func (s *ConnectionStore) Resolve(ctx context.Context, userID, connType, name st
AND ( AND (
(scope = 'personal' AND owner_id = $2) (scope = 'personal' AND owner_id = $2)
OR (scope = 'team' AND owner_id IN ( OR (scope = 'team' AND owner_id IN (
SELECT team_id FROM team_members WHERE user_id = $2 SELECT team_id::text FROM team_members WHERE user_id = $2::uuid
)) ))
OR (scope = 'global') OR (scope = 'global')
)`, connCols) )`, connCols)
@@ -105,7 +105,7 @@ func (s *ConnectionStore) ResolveAll(ctx context.Context, userID, connType strin
AND ( AND (
(scope = 'personal' AND owner_id = $2) (scope = 'personal' AND owner_id = $2)
OR (scope = 'team' AND owner_id IN ( OR (scope = 'team' AND owner_id IN (
SELECT team_id FROM team_members WHERE user_id = $2 SELECT team_id::text FROM team_members WHERE user_id = $2::uuid
)) ))
OR (scope = 'global') OR (scope = 'global')
) )
@@ -125,7 +125,7 @@ func (s *ConnectionStore) ListAccessible(ctx context.Context, userID string) ([]
AND ( AND (
(scope = 'personal' AND owner_id = $1) (scope = 'personal' AND owner_id = $1)
OR (scope = 'team' AND owner_id IN ( OR (scope = 'team' AND owner_id IN (
SELECT team_id FROM team_members WHERE user_id = $1 SELECT team_id::text FROM team_members WHERE user_id = $1::uuid
)) ))
OR (scope = 'global') OR (scope = 'global')
) )