daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.   I'm unsure if the fields selected here (and the filters applied)
  3.   are significant, but this I can somewhat reliably cause
  4.   Redshift to restart by running this query concurrently with
  5.   the rapid_drop_and_create.sql query below.
  6. */
  7.  
  8. select
  9.     ordinal_position,
  10.     view_schema,
  11.     col_name,
  12.     case
  13.         when col_type ilike 'character varying%' then
  14.             'character varying'
  15.         when col_type ilike 'numeric%' then 'numeric'
  16.         else col_type
  17.     end as col_type,
  18.     case
  19.         when col_type like 'character%'
  20.         then nullif(REGEXP_SUBSTR(col_type, '[0-9]+'), '')::int
  21.         else null
  22.     end as character_maximum_length,
  23.     case
  24.         when col_type like 'numeric%'
  25.         then nullif(REGEXP_SUBSTR(col_type, '[0-9,]+'), '')
  26.         else null
  27.     end as numeric_size
  28.  
  29. from pg_get_late_binding_view_cols()
  30. cols(view_schema name, view_name name, col_name name,
  31.      col_type varchar, ordinal_position int)
  32. where view_schema = 'analytics'
  33.   and view_name = 'all_days'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top