I am trying to populate a view in PostGIS and in this view I want it to contain a substring based on 2 string positions. See below for my code.
CREATE OR REPLACE VIEW vw_actions AS SELECT ls.f_table_schema, ls.f_table_name, (SELECT substr(ls.attribute_actions_text, strpos(ls.attribute_actions_text, 'name="')+6, strpos(ls.attribute_actions_text, '"/>') - strpos(ls.attribute_actions_text, 'name="'))) AS actions FROM layer_styles ls;ALTER TABLE vw_actions OWNER TO postgres;The outcome is that it doesn't like minus numbers when using strpos. I can get it go forward 6 characters to remove the 'name="' from the returned substring but cannot remove the '"/>'.
It returns the following:
View SHED Database"/> where I want it return:
View SHED DatabaseAny suggestions would be greatly appreciated.
Thanks in advance.
أكثر...
CREATE OR REPLACE VIEW vw_actions AS SELECT ls.f_table_schema, ls.f_table_name, (SELECT substr(ls.attribute_actions_text, strpos(ls.attribute_actions_text, 'name="')+6, strpos(ls.attribute_actions_text, '"/>') - strpos(ls.attribute_actions_text, 'name="'))) AS actions FROM layer_styles ls;ALTER TABLE vw_actions OWNER TO postgres;The outcome is that it doesn't like minus numbers when using strpos. I can get it go forward 6 characters to remove the 'name="' from the returned substring but cannot remove the '"/>'.
It returns the following:
View SHED Database"/> where I want it return:
View SHED DatabaseAny suggestions would be greatly appreciated.
Thanks in advance.
أكثر...