Skip to content

Instantly share code, notes, and snippets.

View 0x777's full-sized avatar

Vamshi Surabhi 0x777

  • Bangalore, India
View GitHub Profile
-- From 24 to 23
ALTER TABLE hdb_catalog.hdb_table DROP COLUMN configuration;
DROP VIEW IF EXISTS hdb_catalog.hdb_table_info_agg;
DROP VIEW IF EXISTS hdb_catalog.hdb_column;
CREATE VIEW hdb_catalog.hdb_column AS
WITH primary_key_references AS (
SELECT fkey.table_schema AS src_table_schema
, fkey.table_name AS src_table_name
@0x777
0x777 / 20_to_19.sql
Created September 4, 2019 11:46
down migration from catalog version 20 to 19
ALTER TABLE hdb_catalog.hdb_table DROP COLUMN is_enum;
CREATE FUNCTION hdb_catalog.hdb_table_oid_check() RETURNS trigger AS
$function$
BEGIN
IF (EXISTS (SELECT 1 FROM information_schema.tables st WHERE st.table_schema = NEW.table_schema AND st.table_name = NEW.table_name)) THEN
return NEW;
ELSE
RAISE foreign_key_violation using message = 'table_schema, table_name not in information_schema.tables';
return NULL;
create or replace function add_on_update_trigger
(schema_name text, table_name text, column_name text)
returns void AS $body$
declare
target_table text =
quote_ident(schema_name) || '.' || quote_ident(table_name);
trig_name text =
quote_ident(
'update_' || schema_name || '_' || table_name || '_' || column_name
);

Keybase proof

I hereby claim:

  • I am 0x777 on github.
  • I am 0x777 (https://keybase.io/0x777) on keybase.
  • I have a public key ASA2k6XN80WgTp3G1eaX-X4ZGxEZ1N4WkCgGwa8pkS7E8wo

To claim this, I am signing this object: