Class: PG::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/pglite_shims/pg.rb

Class Method Summary collapse

Class Method Details

.quote_ident(str) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/active_record/connection_adapters/pglite_shims/pg.rb', line 16

def quote_ident(str)
  str = str.to_s
  return '""' if str.empty?
  if str =~ /[^a-zA-Z_0-9]/ || str =~ /^[0-9]/
    '"' + str.gsub('"', '""') + '"'
  else
    str
  end
end