fix generated columns in mutable columns for PostgreSQL
Fix https://github.com/go-jet/jet/issues/209.
This commit is contained in:
parent
ce3c622fa4
commit
a4191b4953
6 changed files with 20 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ type Column struct {
|
|||
Name string
|
||||
IsPrimaryKey bool
|
||||
IsNullable bool
|
||||
IsGenerated bool
|
||||
DataType DataType
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ func (t Table) MutableColumns() []Column {
|
|||
var ret []Column
|
||||
|
||||
for _, column := range t.Columns {
|
||||
if column.IsPrimaryKey {
|
||||
if column.IsPrimaryKey || column.IsGenerated {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ WITH primaryKeys AS (
|
|||
)
|
||||
SELECT column_name as "column.Name",
|
||||
is_nullable = 'YES' as "column.isNullable",
|
||||
is_generated = 'ALWAYS' as "column.isGenerated",
|
||||
(EXISTS(SELECT 1 from primaryKeys as pk where pk.column_name = columns.column_name)) as "column.IsPrimaryKey",
|
||||
dataType.kind as "dataType.Kind",
|
||||
(case dataType.Kind when 'base' then data_type else LTRIM(udt_name, '_') end) as "dataType.Name",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue