1 | SET statement_timeout = 0;
|
---|
2 | SET lock_timeout = 0;
|
---|
3 | SET idle_in_transaction_session_timeout = 0;
|
---|
4 | SET client_encoding = 'UTF8';
|
---|
5 | SET standard_conforming_strings = on;
|
---|
6 | SELECT pg_catalog.set_config('search_path', '', false);
|
---|
7 | SET check_function_bodies = false;
|
---|
8 | SET xmloption = content;
|
---|
9 | SET client_min_messages = warning;
|
---|
10 | SET row_security = off;
|
---|
11 |
|
---|
12 | SET default_tablespace = '';
|
---|
13 |
|
---|
14 | SET default_table_access_method = heap;
|
---|
15 |
|
---|
16 | CREATE TABLE public.table2 (
|
---|
17 | id bigint,
|
---|
18 | from_datetime timestamp with time zone,
|
---|
19 | to_datetime timestamp with time zone
|
---|
20 | );
|
---|
21 |
|
---|
22 | COPY public.table2 (id, from_datetime, to_datetime) FROM stdin;
|
---|
23 | 1 2022-03-21 01:00:00+01 2022-03-21 01:59:59+01
|
---|
24 | \.
|
---|
25 |
|
---|
26 | create 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 |
|
---|
28 | SELECT * FROM public.myview where id = 1647824400;
|
---|