summaryrefslogtreecommitdiff
path: root/python/skytools/quoting.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/skytools/quoting.py')
-rw-r--r--python/skytools/quoting.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/python/skytools/quoting.py b/python/skytools/quoting.py
index 19854a5f..10492b37 100644
--- a/python/skytools/quoting.py
+++ b/python/skytools/quoting.py
@@ -9,7 +9,8 @@ __all__ = [
"db_urlencode", "db_urldecode", "unescape",
"quote_bytea_literal", "quote_bytea_copy", "quote_statement",
- "quote_ident", "quote_fqident", "quote_json", "unescape_copy"
+ "quote_ident", "quote_fqident", "quote_json", "unescape_copy",
+ "unquote_ident", "unquote_literal",
]
try:
@@ -105,3 +106,9 @@ def unescape_copy(val):
return None
return unescape(val)
+def unquote_sql_ident(val):
+ """Unquotes possibly quoted SQL identifier."""
+ if val[0] == '"' and val[-1] == '"':
+ return val[1:-1].replace('""', '"')
+ return val
+