내용으로 건너뛰기

Redshift view with current_setting('timezone') error when filtering using sub-select

0

My team have their session timezones set differently, so to provide a consistent output, I thought I would utilise the following logic in views: convert_timezone(current_setting('timezone'),'Australia/Melbourne',<timestamp>) I have a view that also utilises the super datatype to simplify the extraction of data from json fields from a source system.

However testing a view prior to deployment, the following query with sub-select filter expressions fails:

create temp table test as
select * from <viewname>
where start_date between (select <date>) and (select <date>);

SQL Error [XX000]: ERROR: Query unsupported due to an internal error.

The following code illustrates the issue:

create or replace view sandpit.test as
select a.*, json_super."test" as test_val
from (
select convert_timezone('UTC','Australia/Melbourne',getdate()) as current_ts_AEST
    ,convert_timezone(current_setting('timezone'),'Australia/Melbourne',getdate()) as current_tz_AEST --comment out this line and both statements below succeed
    ,json_parse('{"test":1}') as json_super
) a
with no schema binding;

select * from sandpit.test where current_ts_AEST < getdate()::date + 1; --Works
select * from sandpit.test where current_ts_AEST < (select '2023-08-01'); --Fails with error
  • For anyone following this issue. AWS has confirmed it's an issue and Redshift engineering is working on a fix.

질문됨 3년 전537회 조회

1개 답변
0

Hello,

To answer your question, we require details that are non-public information. Please open a support case with AWS using the following link with Redshift as the service and fill out the necessary template details.

https://docs.aws.amazon.com/awssupport/latest/user/case-management.html#creating-a-support-case

AWS
지원 엔지니어

답변함 3년 전

  • Thanks, I've raised case 13290408011

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠