names with upper charactor on postgres will need quotes
This commit is contained in:
parent
717aabf022
commit
e86b5375a5
|
@ -788,6 +788,18 @@ func (db *postgres) Init(d *core.DB, uri *URI) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (db *postgres) needQuote(name string) bool {
|
||||||
|
if db.IsReserved(name) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
for _, c := range name {
|
||||||
|
if c >= 'A' && c <= 'Z' {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (db *postgres) SetQuotePolicy(quotePolicy QuotePolicy) {
|
func (db *postgres) SetQuotePolicy(quotePolicy QuotePolicy) {
|
||||||
switch quotePolicy {
|
switch quotePolicy {
|
||||||
case QuotePolicyNone:
|
case QuotePolicyNone:
|
||||||
|
@ -796,7 +808,7 @@ func (db *postgres) SetQuotePolicy(quotePolicy QuotePolicy) {
|
||||||
db.quoter = q
|
db.quoter = q
|
||||||
case QuotePolicyReserved:
|
case QuotePolicyReserved:
|
||||||
var q = postgresQuoter
|
var q = postgresQuoter
|
||||||
q.IsReserved = db.IsReserved
|
q.IsReserved = db.needQuote
|
||||||
db.quoter = q
|
db.quoter = q
|
||||||
case QuotePolicyAlways:
|
case QuotePolicyAlways:
|
||||||
fallthrough
|
fallthrough
|
||||||
|
|
Loading…
Reference in New Issue