polastre opened a new issue, #764:
URL: https://github.com/apache/incubator-baremaps/issues/764
Consider a function like this, that converts all the columns to lowercase
from a dataset:
```sql
DO $$
DECLARE row record;
BEGIN
FOR row IN SELECT table_schema,table_name,column_name
FROM information_schema.columns
WHERE table_schema = 'public'
AND lower(column_name) != column_name
AND table_name LIKE 'ne_%'
LOOP
EXECUTE format('ALTER TABLE %I.%I RENAME COLUMN %I TO %I',
row.table_schema,row.table_name,row.column_name,lower(row.column_name));
END LOOP;
END $$;
```
If you copy and paste this into Postgres, it works just fine.
If you run it in a `.sql` file in your `workflow.js`, you get the error:
```
java.util.concurrent.ExecutionException:
org.apache.baremaps.workflow.WorkflowException:
org.apache.baremaps.workflow.WorkflowException:
org.postgresql.util.PSQLException: Unterminated dollar quote started at
position 4 in SQL
DO $$
DECLARE row record. Expected terminating $$
at
java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at
java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073)
at org.apache.baremaps.cli.workflow.Execute.call(Execute.java:48)
at org.apache.baremaps.cli.workflow.Execute.call(Execute.java:29)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at
picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2314)
at
picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2316)
at picocli.CommandLine.execute(CommandLine.java:2078)
at org.apache.baremaps.cli.Baremaps.main(Baremaps.java:62)
```
I believe this is again due to `;` parsing by baremaps.
version: 0.7.2-rc1
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]