Re: [postgis-users] Can we treat a large block of psql codes as a string and execute the string?

2020-04-21 Thread Shaozhong SHI
Hi, Giuseppe, The following is the error message. NOTICE: identifier "SET style_description = CASE WHEN descriptiveterm ~* 'Polygon Closing Link' THEN 'Polygon Closing Line' ELSE 'Unclassified' END" will be truncated to "SET style_description = CASE WHEN descriptiveterm ~* 'Polygon C" NOTICE: ide

Re: [postgis-users] Can we treat a large block of psql codes as a string and execute the string?

2020-04-21 Thread Shaozhong SHI
Hi, Giuseppe, See the following code to see what I am trying to do. DO $$ DECLARE wccdate TEXT; output TEXT := 'public.topographic_line_buckinghamshire_milton_keynes_line'; psqlstring TEXT; BEGIN execute format('ALTER TABLE %s ADD style_description varchar(50)', output); execute format('ALTER T

Re: [postgis-users] Can we treat a large block of psql codes as a string and execute the string?

2020-04-21 Thread Giuseppe Broccolo
Hi Shao, Maybe you are looking about how to pass SQL statements via a shell here-document: psql [options] < ha scritto: > It is quite appealing to wrap up a large block of psql codes as a string > and execute the string. > > And, how to deal with quotes within quotes. > > I tried short text stri

[postgis-users] How to resolve text string truncation issue

2020-04-21 Thread Shaozhong SHI
I kept coming across this error message. Notice: identifier "what so ever" will be truncated to "what so". I want to compose very long psql text strings, so that I can execute the string. Can anyone help to explain and shed light on how to resolve this issue? Regards, Shao

[postgis-users] Can we treat a large block of psql codes as a string and execute the string?

2020-04-21 Thread Shaozhong SHI
It is quite appealing to wrap up a large block of psql codes as a string and execute the string. And, how to deal with quotes within quotes. I tried short text strings. It worked well, but it does not seem to work with very long strings in different lines. Can anyone shed light on this? Regard