Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: disable arrays as PKs #50656

Closed
maddyblue opened this issue Jun 25, 2020 · 0 comments · Fixed by #50662
Closed

sql: disable arrays as PKs #50656

maddyblue opened this issue Jun 25, 2020 · 0 comments · Fixed by #50662
Assignees
Labels
A-sql-execution Relating to SQL execution. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.

Comments

@maddyblue
Copy link
Contributor

The recent addition of an array index encoding had a side effect of enabling them in PKs. This is the first column type that has both inverted and forward index support. However neither the exec nor opt teams have had opportunity to think through the implications of this, and they need to be disabled until all teams sign off.

@maddyblue maddyblue added C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. A-sql-execution Relating to SQL execution. labels Jun 25, 2020
@maddyblue maddyblue self-assigned this Jun 25, 2020
craig bot pushed a commit that referenced this issue Jun 29, 2020
50662: sql: disable arrays in forward indexes r=mjibson a=mjibson

There are some open questions about inverted index types being used in
forward indexes. Disable those for now.

Fixes #50656
See #50659
See #17154

Release note (sql change): disable arrays in non-inverted indexes.

50742: sql: granular detection of non-immutable constant casts r=RaduBerinde a=RaduBerinde

#### opt: improve tests for parsing timestamps

Add more `sem/tree` unit tests for parsing time-related types. In
particular:
 - relative timestamps ('now', 'tomorrow')
 - TZ variants
 - timestamps that include timezones for DDate, DTime
 - cases where the result depends on the current time and/or timezone.

In a future change, the parsing functions will also return a flag
indicating if the result depends on the context or not; these tests
will be updated to check that flag as well.

Release note: None

#### pgdate: add WithoutTimezone variants

The way we parse DTimestamp (and other non-TZ variants) is convoluted:
we initially parse it just like a DTimestampTZ, and then we strip away
the timezone (adjusting it so the timestamp looks the same as before,
except with UTC location). This means that we incorporate the local
timezone, even though it is inconsequential.

This change adds WithoutTimezone API variants to `pgdate` which avoids
using the local timezone. This will allow extending the parsing APIs
to indicate whether the result depends on the current time or
timezone.

Release note: None

#### sql: use dummy ParseTimeContext during type-checking

We are not supposed to use any context-dependent parsing results
during type-checking. As such, use a dummy ParseTimeContext instead of
having SemaContext implement the interface.

Release note: None

#### sql: granular detection of non-immutable constant casts

Interpreting a timestamp (and similar types) can depend on the current
timezone or even the current time. A recent change prevented these
casts from happening during type-checking.

Unfortunately, this includes a lot of common cases which aren't
actually context-dependent. The most important are dates and
timestamps without time zone (except rare cases like 'now' or
'tomorrow'). In these cases, the type-checked expressions won't seem
constant and won't be able to be used for partitioning, index
predicates, etc.

This change improves the parsing functions to return a
`dependsOnContext` boolean. When this flag is false, the result is
immutable and is replaced during type-checking.

The volatility of the version of date_trunc that returns a TIMESTAMPTZ
is corrected to Stable.

Release note: None

Co-authored-by: Matt Jibson <[email protected]>
Co-authored-by: Radu Berinde <[email protected]>
@craig craig bot closed this as completed in cd1318a Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-execution Relating to SQL execution. C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant