Skip to content

Commit 4fb6d7a

Browse files
committed
fixed PostgreSql.AutoIncrement
1 parent b81ddef commit 4fb6d7a

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/SmartCode.CLI/OfficialRazorTemplates/SqlMap-Insert.cshtml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
<text>Select Scope_Identity();</text>
5656
break;
5757
}
58+
case DbProvider.PostgreSql:
59+
{
60+
<text>Returning @pkCol.Name;</text>
61+
break;
62+
}
5863
}
5964
@Html.NewLine()
6065
}

src/SmartCode.CLI/SmartCode.CLI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<RepositoryType>Github</RepositoryType>
2121
<PackageTags>SmartCode SmartSql</PackageTags>
2222
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
23-
<Version>1.4.3</Version>
23+
<Version>1.4.6</Version>
2424
<PackageIconUrl>https://raw.githubusercontent.com/Ahoo-Wang/SmartCode/master/doc/Logo.png</PackageIconUrl>
2525
</PropertyGroup>
2626

src/SmartCode.Db/Maps/Database-PostgreSql.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737
When cs.conkey[1] Then 1
3838
Else 0 End
3939
) As "IsPrimaryKey",
40-
0 As "AutoIncrement",
40+
(
41+
Case When pg_get_serial_sequence(c.relname, a.attname) Is Null Then 0
42+
Else 1 End
43+
)As "AutoIncrement",
4144
col_description(a.attrelid,a.attnum) as "Description"
4245
From pg_class c
4346
Left Join pg_attribute a on a.attrelid=c.oid

0 commit comments

Comments
 (0)