mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-05 02:46:10 +02:00
Default to a static list of PostgreSQL keywords.
In some cases (such as when using a very old PostgreSQL instance or an Amazon Redshift service, as in #255), the function pg_get_keywords() does not exists but we assume that pgloader might still be able to complete its job. We're better off with a static list of keywords than with a unhandled error here, so let's see what happens next with Redshift.
This commit is contained in:
parent
1f7382cd0d
commit
88c801997e
@ -191,10 +191,119 @@
|
||||
|
||||
(defun list-reserved-keywords (pgconn)
|
||||
"Connect to PostgreSQL DBNAME and fetch reserved keywords."
|
||||
(with-pgsql-connection (pgconn)
|
||||
(pomo:query "select word
|
||||
(handler-case
|
||||
(with-pgsql-connection (pgconn)
|
||||
(pomo:query "select word
|
||||
from pg_get_keywords()
|
||||
where catcode IN ('R', 'T')" :column)))
|
||||
where catcode IN ('R', 'T')" :column))
|
||||
;; support for Amazon Redshift
|
||||
(cl-postgres-error::syntax-error-or-access-violation (e)
|
||||
;; 42883 undefined_function
|
||||
;; Database error 42883: function pg_get_keywords() does not exist
|
||||
;;
|
||||
;; the following list comes from a manual query against a local
|
||||
;; PostgreSQL server (version 9.5devel), it's better to have this list
|
||||
;; than nothing at all.
|
||||
(declare (ignore e))
|
||||
(list "all"
|
||||
"analyse"
|
||||
"analyze"
|
||||
"and"
|
||||
"any"
|
||||
"array"
|
||||
"as"
|
||||
"asc"
|
||||
"asymmetric"
|
||||
"authorization"
|
||||
"binary"
|
||||
"both"
|
||||
"case"
|
||||
"cast"
|
||||
"check"
|
||||
"collate"
|
||||
"collation"
|
||||
"column"
|
||||
"concurrently"
|
||||
"constraint"
|
||||
"create"
|
||||
"cross"
|
||||
"current_catalog"
|
||||
"current_date"
|
||||
"current_role"
|
||||
"current_schema"
|
||||
"current_time"
|
||||
"current_timestamp"
|
||||
"current_user"
|
||||
"default"
|
||||
"deferrable"
|
||||
"desc"
|
||||
"distinct"
|
||||
"do"
|
||||
"else"
|
||||
"end"
|
||||
"except"
|
||||
"false"
|
||||
"fetch"
|
||||
"for"
|
||||
"foreign"
|
||||
"freeze"
|
||||
"from"
|
||||
"full"
|
||||
"grant"
|
||||
"group"
|
||||
"having"
|
||||
"ilike"
|
||||
"in"
|
||||
"initially"
|
||||
"inner"
|
||||
"intersect"
|
||||
"into"
|
||||
"is"
|
||||
"isnull"
|
||||
"join"
|
||||
"lateral"
|
||||
"leading"
|
||||
"left"
|
||||
"like"
|
||||
"limit"
|
||||
"localtime"
|
||||
"localtimestamp"
|
||||
"natural"
|
||||
"not"
|
||||
"notnull"
|
||||
"null"
|
||||
"offset"
|
||||
"on"
|
||||
"only"
|
||||
"or"
|
||||
"order"
|
||||
"outer"
|
||||
"overlaps"
|
||||
"placing"
|
||||
"primary"
|
||||
"references"
|
||||
"returning"
|
||||
"right"
|
||||
"select"
|
||||
"session_user"
|
||||
"similar"
|
||||
"some"
|
||||
"symmetric"
|
||||
"table"
|
||||
"then"
|
||||
"to"
|
||||
"trailing"
|
||||
"true"
|
||||
"union"
|
||||
"unique"
|
||||
"user"
|
||||
"using"
|
||||
"variadic"
|
||||
"verbose"
|
||||
"when"
|
||||
"where"
|
||||
"window"
|
||||
"with"))))
|
||||
|
||||
(defun reset-all-sequences (pgconn &key tables)
|
||||
"Reset all sequences to the max value of the column they are attached to."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user