Redshift does not seem to support one of the following:
where left(field1,4) like '[0-9][0-9][0-9][0-9]' where left(field1,4) ~ '^[0-9]{4}' where left(field1,4) like '^[0-9]{4}'
what works:
where left(field1,4) between 0 and 9999
returns all lines starting with four numeric characters.
it seems that although field1 is a type string, the between function interprets left (field1,4) as one when the string characters are numeric (and does not give an error if they are not numeric). I will follow up if I find a problem. For example, I do not do anything less than 1000, so I assume, but I'm not sure, that 0001 is interpreted as 1.
Elm
source share