This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Alastair McKinley 2020 | |
begin; | |
create table testing as | |
select value, | |
type_id, | |
created, | |
case when row_number() over (partition by type_id,value order by created desc ) = 1 | |
then true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Alastair McKinley 2020 | |
begin; | |
create table testing as | |
select jsonb_build_object('value',value) as data, | |
type_id, | |
created, | |
case when row_number() over (partition by type_id,value order by created desc ) = 1 | |
then true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: bsd-3-clause | |
border: no | |
scrolling: no | |
height: 500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
drop table if exists record; | |
drop table if exists record_type; | |
create extension if not exists pgcrypto; | |
-- attributes of each record type including a parameter used in the indexes | |
create table record_type ( | |
id bigint not null primary key, | |
index_n_chars integer not null, | |
name text unique | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
license: mit |