summaryrefslogtreecommitdiffstats
path: root/vendor/xorm.io/xorm/dialects/postgres.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/xorm.io/xorm/dialects/postgres.go')
-rw-r--r--vendor/xorm.io/xorm/dialects/postgres.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/vendor/xorm.io/xorm/dialects/postgres.go b/vendor/xorm.io/xorm/dialects/postgres.go
index a2c0de74f0..e76e5b7ed8 100644
--- a/vendor/xorm.io/xorm/dialects/postgres.go
+++ b/vendor/xorm.io/xorm/dialects/postgres.go
@@ -824,6 +824,11 @@ func (db *postgres) SetQuotePolicy(quotePolicy QuotePolicy) {
}
}
+// FormatBytes formats bytes
+func (db *postgres) FormatBytes(bs []byte) string {
+ return fmt.Sprintf("E'\\x%x'", bs)
+}
+
func (db *postgres) SQLType(c *schemas.Column) string {
var res string
switch t := c.SQLType.Name; t {
@@ -833,12 +838,12 @@ func (db *postgres) SQLType(c *schemas.Column) string {
case schemas.Bit:
res = schemas.Boolean
return res
- case schemas.MediumInt, schemas.Int, schemas.Integer:
+ case schemas.MediumInt, schemas.Int, schemas.Integer, schemas.UnsignedInt:
if c.IsAutoIncrement {
return schemas.Serial
}
return schemas.Integer
- case schemas.BigInt:
+ case schemas.BigInt, schemas.UnsignedBigInt:
if c.IsAutoIncrement {
return schemas.BigSerial
}
@@ -1052,6 +1057,10 @@ WHERE n.nspname= s.table_schema AND c.relkind = 'r'::char AND c.relname = $1%s A
}
}
+ if colDefault != nil && *colDefault == "unique_rowid()" { // ignore the system column added by cockroach
+ continue
+ }
+
col.Name = strings.Trim(colName, `" `)
if colDefault != nil {