Skip to content

Instantly share code, notes, and snippets.

@jonasdw
Last active June 3, 2020 13:38
Show Gist options
  • Save jonasdw/76d04e6d622e6a15a46ea8acb8f177ba to your computer and use it in GitHub Desktop.
Save jonasdw/76d04e6d622e6a15a46ea8acb8f177ba to your computer and use it in GitHub Desktop.
let writeResult =
Sql.connectFromConfig conn
|> Sql.executeTransaction [
"INSERT INTO test VALUES (@crsnummers)", [
[
"@crsnummers " , Sql.intArray [| 1; 3; 7; |]
]
]
]
// RUNNING THIS CODE RESULTS IN
Npgsql.PostgresException (0x80004005): 42703: column "crsnummers" does not exist
at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlConnector.<>c__DisplayClass160_0.<<DoReadMessage>g__ReadMessageLong|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Npgsql.NpgsqlDataReader.NextResult(Boolean async, Boolean isConsuming)
at Npgsql.NpgsqlDataReader.NextResult()
at Npgsql.NpgsqlCommand.ExecuteReaderAsync(CommandBehavior behavior, Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
at Npgsql.NpgsqlCommand.ExecuteNonQuery()
at Npgsql.FSharp.SqlModule.executeTransaction$cont@548(FSharpList`1 queries, SqlProps props, Unit unitVar)
at Npgsql.FSharp.SqlModule.executeTransaction(FSharpList`1 queries, SqlProps props)
Exception data:
Severity: ERROR
SqlState: 42703
MessageText: column "crsnummers" does not exist
Hint: There is a column named "crsnummers" in table "test", but it cannot be referenced from this part of the query.
Position: 27
File: parse_relation.c
Line: 3294
Routine: errorMissingColumn
let writeResult =
Sql.connectFromConfig conn
|> Sql.executeTransaction [
"INSERT INTO test VALUES ('{1, 3, 7}')", []
]
// RUNNING THIS BLOCK WORKS
create table test(
crsnummers int[] NOT NULL
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment