MCPcopy Create free account
hub / github.com/dolthub/doltgresql / typeCheckSubqueryWithIn

Function typeCheckSubqueryWithIn

postgres/parser/sem/tree/type_check.go:1817–1831  ·  view source on GitHub ↗

typeCheckSubqueryWithIn checks the case where the right side of an IN expression is a subquery.

(left, right *types.T)

Source from the content-addressed store, hash-verified

1815// typeCheckSubqueryWithIn checks the case where the right side of an IN
1816// expression is a subquery.
1817func typeCheckSubqueryWithIn(left, right *types.T) error {
1818 if right.Family() == types.TupleFamily {
1819 // Subqueries come through as a tuple{T}, so T IN tuple{T} should be
1820 // accepted.
1821 if len(right.TupleContents()) != 1 {
1822 return pgerror.Newf(pgcode.InvalidParameterValue,
1823 unsupportedCompErrFmt, fmt.Sprintf(compSignatureFmt, left, In, right))
1824 }
1825 if !left.EquivalentOrNull(right.TupleContents()[0]) {
1826 return pgerror.Newf(pgcode.InvalidParameterValue,
1827 unsupportedCompErrFmt, fmt.Sprintf(compSignatureFmt, left, In, right))
1828 }
1829 }
1830 return nil
1831}
1832
1833func typeCheckComparisonOp(
1834 ctx context.Context, semaCtx *SemaContext, op ComparisonOperator, left, right Expr,

Callers 1

typeCheckComparisonOpFunction · 0.85

Calls 4

NewfFunction · 0.92
FamilyMethod · 0.80
TupleContentsMethod · 0.80
EquivalentOrNullMethod · 0.80

Tested by

no test coverage detected