Skip to content

fix: use correct syntax for RETURNING in query#234

Merged
christofluethi merged 1 commit intoacend:masterfrom
mburri:fix/reactive-programming-returning-syntax
Aug 25, 2025
Merged

fix: use correct syntax for RETURNING in query#234
christofluethi merged 1 commit intoacend:masterfrom
mburri:fix/reactive-programming-returning-syntax

Conversation

@mburri
Copy link
Copy Markdown
Collaborator

@mburri mburri commented Aug 22, 2025

Using the proposed code snippet in 25_reactive_programming.md#359 resulted in an exception being thrown:

Details:
        Error id 291c8a46-0a80-41b7-99d8-6d9287691027-8, java.util.NoSuchElementException: Column id does not exist
Decorate (Source code):
        Exception in SensorMeasurement.java:26
          24  
          25      public SensorMeasurement(Row row) {
        → 26          this.id = row.getLong("id");
          27          this.data = row.getDouble("data");
          28          this.time = Instant.from(row.getOffsetDateTime("time"));
Stack:
        java.util.NoSuchElementException: Column id does not exist
        at io.vertx.sqlclient.Row.getLong(Row.java:125)
        at io.vertx.mutiny.sqlclient.Row.getLong(Row.java:138)
        at org.acme.entity.SensorMeasurement.<init>(SensorMeasurement.java:26)
        at org.acme.entity.SensorMeasurement.lambda$save$2(SensorMeasurement.java:58)

The actual solution in the /solutions folder does not throw the exception, but it does not return the new id of the SensorMeasurement.

The list of columns in RETURNING should not be placed in paranthesis.
See https://www.postgresql.org/docs/current/dml-returning.html
(unfortunatly - it has no example with multiple columns)

@christofluethi christofluethi merged commit 129b8a2 into acend:master Aug 25, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants