[Bug]: `ScriptUtils` converts adjacent string literals to invalid syntax
Maintainers usually reply within 1 day
@marktech0813 is already working on this.
Since Nov 11, 2025.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- java, postgresql
- Domain
- databases, testing-qa
Research direction
Start in ScriptUtils.java around executeDatabaseScript, using the PostgreSQL script shown in the report to reproduce the statement splitting. Verify the resulting statements preserve the required separation between adjacent string literals and that the script executes successfully against PostgreSQL.
Written by the indexing model from the issue text.
Description
Module
PostgreSQL
Testcontainers version
2.0.1
Using the latest Testcontainers version?
Yes
Host OS
macOS
Host Arch
arm64
Docker version
Client:
Version: 28.5.1
API version: 1.51
Go version: go1.24.8
Git commit: e180ab8
Built: Wed Oct 8 12:16:17 2025
OS/Arch: darwin/arm64
Context: desktop-linux
Server: Docker Desktop 4.49.0 (208700)
Engine:
Version: 28.5.1
API version: 1.51 (minimum version 1.24)
Go version: go1.24.8
Git commit: f8215cc
Built: Wed Oct 8 12:18:25 2025
OS/Arch: linux/arm64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0
What happened?
ScriptUtils splits an init script into a list of statements. This is valid syntax:
CREATE TABLE test (
x int
);
COMMENT ON COLUMN test.x
IS 'First sentence. '
'Second sentence';
But ScriptUtils converts this into these two statements:
CREATE TABLE test ( x int )
COMMENT ON COLUMN test.x IS 'First sentence. ' 'Second sentence'
The second statement isn't valid because the adjacent string literals need to be separated by at least one newline.
Relevant log output
Caused by: org.testcontainers.ext.ScriptUtils$ScriptStatementFailedException: Script execution failed (initPostgres.sql:2): COMMENT ON COLUMN test.x IS 'First sentence. ' 'Second sentence'
at org.testcontainers.jdbc.JdbcDatabaseDelegate.execute(JdbcDatabaseDelegate.java:63)
at org.testcontainers.delegate.AbstractDatabaseDelegate.execute(AbstractDatabaseDelegate.java:38)
at org.testcontainers.ext.ScriptUtils.executeDatabaseScript(ScriptUtils.java:307)
... 83 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "'Second sentence'"
Position: 48
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2736)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2421)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:372)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:525)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:435)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:357)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:342)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:318)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:313)
at org.testcontainers.jdbc.JdbcDatabaseDelegate.execute(JdbcDatabaseDelegate.java:50)
... 85 common frames omitted
Additional Information
No response
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 2k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 11
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from testcontainers/testcontainers-java
-
[Bug]: WaitStrategyTarget Handles Multiple Ports Differently to DocumentationPossibly taken @suvvvv claimed this 2 days ago. Opentype/bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
testcontainers/testcontainers-java#12196 ·
Maintainers usually reply within 1 day
-
[Bug]: DockerImageName treats uppercase registry names as repository pathsPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
testcontainers/testcontainers-java#12186 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug]: withStartupTimeout() changes the startup timeout of all containers that use the default wait strategyPossibly taken @aymenjamaaoui claimed this 18 days ago. Opentype/bug
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
testcontainers/testcontainers-java#12171 · 1 comment ·
Maintainers usually reply within 1 day
-
[Enhancement]: Document why singleton containers are required under Spring's test context cachingPossibly taken @zakaullah075 claimed this 111 days ago. Opentype/enhancement
Difficulty 1/5 Under an hour Newbie friendliness 85/100
testcontainers/testcontainers-java#11967 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug]: Cannot reuse Selenium BrowserWebDriverContainers under LinuxPossibly taken @kdelay claimed this 132 days ago. Opentype/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
testcontainers/testcontainers-java#11941 ·
Maintainers usually reply within 1 day
All issues in testcontainers/testcontainers-java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
erkamyaman/rust-anything#1381 ·
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
java-native-access/jna#1757 ·