Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- I'm unsure if the fields selected here (and the filters applied)
- are significant, but this I can somewhat reliably cause
- Redshift to restart by running this query concurrently with
- the rapid_drop_and_create.sql query below.
- */
- select
- ordinal_position,
- view_schema,
- col_name,
- case
- when col_type ilike 'character varying%' then
- 'character varying'
- when col_type ilike 'numeric%' then 'numeric'
- else col_type
- end as col_type,
- case
- when col_type like 'character%'
- then nullif(REGEXP_SUBSTR(col_type, '[0-9]+'), '')::int
- else null
- end as character_maximum_length,
- case
- when col_type like 'numeric%'
- then nullif(REGEXP_SUBSTR(col_type, '[0-9,]+'), '')
- else null
- end as numeric_size
- from pg_get_late_binding_view_cols()
- cols(view_schema name, view_name name, col_name name,
- col_type varchar, ordinal_position int)
- where view_schema = 'analytics'
- and view_name = 'all_days'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement