Ticket #33590: reproduce.sql

File reproduce.sql, 1.0 KB (added by Stefan de Konink, 3 years ago)

Reproducable SQL example.

Line 
1SET statement_timeout = 0;
2SET lock_timeout = 0;
3SET idle_in_transaction_session_timeout = 0;
4SET client_encoding = 'UTF8';
5SET standard_conforming_strings = on;
6SELECT pg_catalog.set_config('search_path', '', false);
7SET check_function_bodies = false;
8SET xmloption = content;
9SET client_min_messages = warning;
10SET row_security = off;
11
12SET default_tablespace = '';
13
14SET default_table_access_method = heap;
15
16CREATE TABLE public.table2 (
17 id bigint,
18 from_datetime timestamp with time zone,
19 to_datetime timestamp with time zone
20);
21
22COPY public.table2 (id, from_datetime, to_datetime) FROM stdin;
231 2022-03-21 01:00:00+01 2022-03-21 01:59:59+01
24\.
25
26create view public.myview as select extract(epoch from scheduled) as id, scheduled, exact_schedule_id, coalesce(v.id, 0) as negative_schedule_id from (select '2022-03-21'::date + '01:00:00'::time as scheduled, 1 as exact_schedule_id) as u left join public.table2 as v on (u.scheduled between v.from_datetime and v.to_datetime) order by scheduled asc;
27
28SELECT * FROM public.myview where id = 1647824400;
Back to Top