Commit 4b74ee5
Christian Findlay
[BUG7] Quote RETURNING clause PK column in INSERT codegen + 0.9.3-beta
PostgresCli.GenerateInsertMethod and GenerateInsertTransactionOverload
hard-coded `RETURNING id` (lowercase) in the emitted INSERT SQL.
For tables whose PK column is PascalCase (e.g. "Id", "PatientId")
this fails at runtime with:
ERROR: column "id" does not exist
because Postgres lower-cases unquoted identifiers and the actual PK
column name is case-sensitive (it was created with quoted ident).
Fix: emit `RETURNING ""{table.PrimaryKeyColumns[0]}""` (verbatim
escape) so the RETURNING clause references the real PK column with
its case preserved. Falls back to `RETURNING 1` for tables with no
configured primary key. Same fix applied to both the NpgsqlConnection
overload and the IDbTransaction overload of Insert{Table}Async.
Verified locally: regen of Clinical fhir_PatientOperations.g.cs now
emits `RETURNING ""Id""`, INSERT round-trips through Postgres
without 'column id does not exist' error.
Bumps Directory.Build.props Version to 0.9.3-beta.1 parent 579a935 commit 4b74ee5
2 files changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
854 | 862 | | |
855 | 863 | | |
856 | 864 | | |
| |||
859 | 867 | | |
860 | 868 | | |
861 | 869 | | |
862 | | - | |
| 870 | + | |
863 | 871 | | |
864 | 872 | | |
865 | 873 | | |
| |||
923 | 931 | | |
924 | 932 | | |
925 | 933 | | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
926 | 939 | | |
927 | 940 | | |
928 | 941 | | |
| |||
945 | 958 | | |
946 | 959 | | |
947 | 960 | | |
948 | | - | |
| 961 | + | |
949 | 962 | | |
950 | 963 | | |
951 | 964 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
0 commit comments