On Wed, Dec 29, 2010 at 14:55, Dave Page <[email protected]> wrote:
> On Wed, Dec 29, 2010 at 11:54 AM, Magnus Hagander <[email protected]> wrote:
>> We haven't updated the keywords.cpp file for ages. In fact, so long
>> ago that the instructions are incorrect.
>>
>> Recent versions of postgresql installs the list of keywords in
>> kwlist.h. That requires PostgreSQL 8.4 or later.
>>
>> How old versions of the PostgreSQL *source* do we accept building
>> against? Couldn't we just switch to using this include file instead,
>> thus saying you need 8.4 or later to build? (it should still *run*
>> against earlier versions just fine..)
>
> Iirc, we need 8.3 (or whichever version included pgconninfoparse). I'm
> fine with moving to using the new include file - iirc, most distros
> have an 8.4 build now.
That turned out to be a bit more work than I thought, mainly because
there were EnterpriseDB and Greenplum keywords included in the pgadmin
list - which was only documented in one of the two places where they
occurred :-)
Anyway, attached is a patch that I believe does this right. If you
prefer an easier view, see
https://github.com/mhagander/pgadmin3/compare/master...keywords
Does this look ok?
It does move the keyword definitions out of the header and into
keywords.cpp - but they aren't used anywhere.. So in general, I'm
fairly confident with it...
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
diff --git a/pgadmin/db/keywords.c b/pgadmin/db/keywords.c
index 0c0f8b0..6ddf381 100644
--- a/pgadmin/db/keywords.c
+++ b/pgadmin/db/keywords.c
@@ -15,11 +15,9 @@
///////////////////////////////////////////////////////////////////////////
//
-// pgAdmin note: This file is based on src/backend/parser/keywords.c from
-// PostgreSQL. It should be periodically updated to include
-// new keywords. The ScanKeywords array and the definition
-// of ScanKeywordLookup are all that are required here - when
-// updating, ensure that no unecessary includes are added.
+// pgAdmin note: This file is based on src/backend/parser/keywords.c and
+// src/backend/parser/kwlookup.c from PostgreSQL, but extended
+// to support EntepriseDB and Greenplum.
//
// This file is under the BSD licence, per PostgreSQL.
///////////////////////////////////////////////////////////////////////////
@@ -28,429 +26,85 @@
#include "parser/keywords.h"
/*
+ * Load the yytokentype list of symbols from PostgreSQL
+ */
+#undef YYTOKENTYPE
+#include <server/parser/gram.h>
+
+/*
+ * For non-PostgreSQL types, define an enumb with their values here
+ * NOTE! Make sure the value doesn't conflict with what's in
+ * server/parser/gram.h - as the PostgreSQL parser grows larger the
+ * highest numbers will increase.
+ */
+enum yytokentype_extra {
+ /* The following additions are keywords in EnterpriseDB */
+ CONNECT_EDB = 800,
+ CONVERT_EDB = 801,
+ MINUS_EDB = 802,
+ NUMBER_EDB = 803,
+ PACKAGE_EDB = 804,
+ SMALLDATETIME_EDB = 805,
+ SMALLFLOAT_EDB = 806,
+ SMALLMONEY_EDB = 807,
+ TINYINT_EDB = 808,
+ TINYTEXT_EDB = 809,
+ VARCHAR2_EDB = 810,
+ EXEC_EDB = 811,
+ LONG_EDB = 812,
+ NOCACHE_EDB = 813,
+ PLS_INTEGER_EDB = 814,
+ RAW_EDB = 815,
+ RETURN_EDB = 816,
+ SYSDATE_EDB = 817,
+ SYSTIMESTAMP_EDB = 818,
+
+ /* The following additions are keywords in Greenplum Database */
+ DISTRIBUTED_GP = 900,
+ LOG_P_GP = 901
+};
+
+
+/*
* List of (keyword-name, keyword-token-value) pairs.
+ */
+#define PG_KEYWORD(a,b,c) {a,b,c},
+const ScanKeyword ScanKeywords[] = {
+#include <server/parser/kwlist.h>
+};
+const int NumScanKeywords = lengthof(ScanKeywords);
+
+/*
+ * Additional pairs here. They need to live in a separate array since
+ * the ScanKeywords array needs to be sorted!
*
* !!WARNING!!: This list must be sorted, because binary
- * search is used to locate entries.
+ * search is used to locate entries.
*/
-static const ScanKeyword ScanKeywords[] = {
- /* name, value, category */
- {"abort", ABORT_P, UNRESERVED_KEYWORD},
- {"absolute", ABSOLUTE_P, UNRESERVED_KEYWORD},
- {"access", ACCESS, UNRESERVED_KEYWORD},
- {"action", ACTION, UNRESERVED_KEYWORD},
- {"add", ADD_P, UNRESERVED_KEYWORD},
- {"admin", ADMIN, UNRESERVED_KEYWORD},
- {"after", AFTER, UNRESERVED_KEYWORD},
- {"aggregate", AGGREGATE, UNRESERVED_KEYWORD},
- {"all", ALL, RESERVED_KEYWORD},
- {"also", ALSO, UNRESERVED_KEYWORD},
- {"alter", ALTER, UNRESERVED_KEYWORD},
- {"always", ALWAYS, UNRESERVED_KEYWORD},
- {"analyse", ANALYSE, RESERVED_KEYWORD}, /* British spelling */
- {"analyze", ANALYZE, RESERVED_KEYWORD},
- {"and", AND, RESERVED_KEYWORD},
- {"any", ANY, RESERVED_KEYWORD},
- {"array", ARRAY, RESERVED_KEYWORD},
- {"as", AS, RESERVED_KEYWORD},
- {"asc", ASC, RESERVED_KEYWORD},
- {"assertion", ASSERTION, UNRESERVED_KEYWORD},
- {"assignment", ASSIGNMENT, UNRESERVED_KEYWORD},
- {"asymmetric", ASYMMETRIC, RESERVED_KEYWORD},
- {"at", AT, UNRESERVED_KEYWORD},
- {"authorization", AUTHORIZATION, TYPE_FUNC_NAME_KEYWORD},
- {"autovacuum_enabled", AUTOVACUUM_E, UNRESERVED_KEYWORD},
- {"autovacuum_vacuum_threshold", AUTOVACUUM_V_TH, UNRESERVED_KEYWORD},
- {"autovacuum_analyze_threshold", AUTOVACUUM_A_TH, UNRESERVED_KEYWORD},
- {"autovacuum_vacuum_scale_factor", AUTOVACUUM_V_SC_F, UNRESERVED_KEYWORD},
- {"autovacuum_analyze_scale_factor", AUTOVACUUM_A_SC_F, UNRESERVED_KEYWORD},
- {"autovacuum_vacuum_cost_delay", AUTOVACUUM_V_COST_D, UNRESERVED_KEYWORD},
- {"autovacuum_vacuum_cost_limit", AUTOVACUUM_V_COST_L, UNRESERVED_KEYWORD},
- {"autovacuum_freeze_min_age", AUTOVACUUM_F_MIN_AGE, UNRESERVED_KEYWORD},
- {"autovacuum_freeze_max_age", AUTOVACUUM_F_MAX_AGE, UNRESERVED_KEYWORD},
- {"autovacuum_freeze_table_age", AUTOVACUUM_F_TBL_AGE, UNRESERVED_KEYWORD},
- {"backward", BACKWARD, UNRESERVED_KEYWORD},
- {"before", BEFORE, UNRESERVED_KEYWORD},
- {"begin", BEGIN_P, UNRESERVED_KEYWORD},
- {"between", BETWEEN, TYPE_FUNC_NAME_KEYWORD},
- {"bigint", BIGINT, COL_NAME_KEYWORD},
- {"binary", BINARY, TYPE_FUNC_NAME_KEYWORD},
- {"bit", BIT, COL_NAME_KEYWORD},
- {"boolean", BOOLEAN_P, COL_NAME_KEYWORD},
- {"both", BOTH, RESERVED_KEYWORD},
- {"by", BY, UNRESERVED_KEYWORD},
- {"cache", CACHE, UNRESERVED_KEYWORD},
- {"called", CALLED, UNRESERVED_KEYWORD},
- {"cascade", CASCADE, UNRESERVED_KEYWORD},
- {"cascaded", CASCADED, UNRESERVED_KEYWORD},
- {"case", CASE, RESERVED_KEYWORD},
- {"cast", CAST, RESERVED_KEYWORD},
- {"chain", CHAIN, UNRESERVED_KEYWORD},
- {"char", CHAR_P, COL_NAME_KEYWORD},
- {"character", CHARACTER, COL_NAME_KEYWORD},
- {"characteristics", CHARACTERISTICS, UNRESERVED_KEYWORD},
- {"check", CHECK, RESERVED_KEYWORD},
- {"checkpoint", CHECKPOINT, UNRESERVED_KEYWORD},
- {"class", CLASS, UNRESERVED_KEYWORD},
- {"close", CLOSE, UNRESERVED_KEYWORD},
- {"cluster", CLUSTER, UNRESERVED_KEYWORD},
- {"coalesce", COALESCE, COL_NAME_KEYWORD},
- {"collate", COLLATE, RESERVED_KEYWORD},
- {"column", COLUMN, RESERVED_KEYWORD},
- {"comment", COMMENT, UNRESERVED_KEYWORD},
- {"commit", COMMIT, UNRESERVED_KEYWORD},
- {"committed", COMMITTED, UNRESERVED_KEYWORD},
- {"concurrently", CONCURRENTLY, UNRESERVED_KEYWORD},
- {"configuration", CONFIGURATION, UNRESERVED_KEYWORD},
- {"connect", CONNECT_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"connection", CONNECTION, UNRESERVED_KEYWORD},
- {"constraint", CONSTRAINT, RESERVED_KEYWORD},
- {"constraints", CONSTRAINTS, UNRESERVED_KEYWORD},
- {"content", CONTENT_P, UNRESERVED_KEYWORD},
- {"conversion", CONVERSION_P, UNRESERVED_KEYWORD},
- {"convert", CONVERT_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"copy", COPY, UNRESERVED_KEYWORD},
- {"cost", COST, UNRESERVED_KEYWORD},
- {"create", CREATE, RESERVED_KEYWORD},
- {"createdb", CREATEDB, UNRESERVED_KEYWORD},
- {"createrole", CREATEROLE, UNRESERVED_KEYWORD},
- {"createuser", CREATEUSER, UNRESERVED_KEYWORD},
- {"cross", CROSS, TYPE_FUNC_NAME_KEYWORD},
- {"csv", CSV, UNRESERVED_KEYWORD},
- {"ctype", CTYPE, RESERVED_KEYWORD},
- {"current", CURRENT_P, UNRESERVED_KEYWORD},
- {"current_date", CURRENT_DATE, RESERVED_KEYWORD},
- {"current_role", CURRENT_ROLE, RESERVED_KEYWORD},
- {"current_time", CURRENT_TIME, RESERVED_KEYWORD},
- {"current_timestamp", CURRENT_TIMESTAMP, RESERVED_KEYWORD},
- {"current_user", CURRENT_USER, RESERVED_KEYWORD},
- {"cursor", CURSOR, UNRESERVED_KEYWORD},
- {"cycle", CYCLE, UNRESERVED_KEYWORD},
- {"database", DATABASE, UNRESERVED_KEYWORD},
- {"day", DAY_P, UNRESERVED_KEYWORD},
- {"deallocate", DEALLOCATE, UNRESERVED_KEYWORD},
- {"dec", DEC, COL_NAME_KEYWORD},
- {"decimal", DECIMAL_P, COL_NAME_KEYWORD},
- {"declare", DECLARE, UNRESERVED_KEYWORD},
- {"default", DEFAULT, RESERVED_KEYWORD},
- {"defaults", DEFAULTS, UNRESERVED_KEYWORD},
- {"deferrable", DEFERRABLE, RESERVED_KEYWORD},
- {"deferred", DEFERRED, UNRESERVED_KEYWORD},
- {"definer", DEFINER, UNRESERVED_KEYWORD},
- {"delete", DELETE_P, UNRESERVED_KEYWORD},
- {"delimiter", DELIMITER, UNRESERVED_KEYWORD},
- {"delimiters", DELIMITERS, UNRESERVED_KEYWORD},
- {"desc", DESC, RESERVED_KEYWORD},
- {"dictionary", DICTIONARY, UNRESERVED_KEYWORD},
- {"disable", DISABLE_P, UNRESERVED_KEYWORD},
- {"discard", DISCARD, UNRESERVED_KEYWORD},
- {"distinct", DISTINCT, RESERVED_KEYWORD},
- {"distributed", DISTRIBUTED_GP, UNRESERVED_KEYWORD}, /* Greenplum Keyword */
- {"do", DO, RESERVED_KEYWORD},
- {"document", DOCUMENT_P, UNRESERVED_KEYWORD},
- {"domain", DOMAIN_P, UNRESERVED_KEYWORD},
- {"double", DOUBLE_P, UNRESERVED_KEYWORD},
- {"drop", DROP, UNRESERVED_KEYWORD},
- {"each", EACH, UNRESERVED_KEYWORD},
- {"else", ELSE, RESERVED_KEYWORD},
- {"enable", ENABLE_P, UNRESERVED_KEYWORD},
- {"encoding", ENCODING, UNRESERVED_KEYWORD},
- {"encrypted", ENCRYPTED, UNRESERVED_KEYWORD},
- {"end", END_P, RESERVED_KEYWORD},
- {"enum", ENUM_P, UNRESERVED_KEYWORD},
- {"escape", ESCAPE, UNRESERVED_KEYWORD},
- {"except", EXCEPT, RESERVED_KEYWORD},
- {"excluding", EXCLUDING, UNRESERVED_KEYWORD},
- {"exclusive", EXCLUSIVE, UNRESERVED_KEYWORD},
- {"exec", EXEC_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"execute", EXECUTE, UNRESERVED_KEYWORD},
- {"exists", EXISTS, COL_NAME_KEYWORD},
- {"explain", EXPLAIN, UNRESERVED_KEYWORD},
- {"external", EXTERNAL, UNRESERVED_KEYWORD},
- {"extract", EXTRACT, COL_NAME_KEYWORD},
- {"false", FALSE_P, RESERVED_KEYWORD},
- {"family", FAMILY, UNRESERVED_KEYWORD},
- {"fetch", FETCH, UNRESERVED_KEYWORD},
- {"fillfactor", FILLFACTOR, UNRESERVED_KEYWORD},
- {"first", FIRST_P, UNRESERVED_KEYWORD},
- {"float", FLOAT_P, COL_NAME_KEYWORD},
- {"for", FOR, RESERVED_KEYWORD},
- {"force", FORCE, UNRESERVED_KEYWORD},
- {"foreign", FOREIGN, RESERVED_KEYWORD},
- {"forward", FORWARD, UNRESERVED_KEYWORD},
- {"freeze", FREEZE, TYPE_FUNC_NAME_KEYWORD},
- {"from", FROM, RESERVED_KEYWORD},
- {"full", FULL, TYPE_FUNC_NAME_KEYWORD},
- {"function", FUNCTION, UNRESERVED_KEYWORD},
- {"global", GLOBAL, UNRESERVED_KEYWORD},
- {"grant", GRANT, RESERVED_KEYWORD},
- {"granted", GRANTED, UNRESERVED_KEYWORD},
- {"greatest", GREATEST, COL_NAME_KEYWORD},
- {"group", GROUP_P, RESERVED_KEYWORD},
- {"handler", HANDLER, UNRESERVED_KEYWORD},
- {"having", HAVING, RESERVED_KEYWORD},
- {"header", HEADER_P, UNRESERVED_KEYWORD},
- {"hold", HOLD, UNRESERVED_KEYWORD},
- {"hour", HOUR_P, UNRESERVED_KEYWORD},
- {"if", IF_P, UNRESERVED_KEYWORD},
- {"ilike", ILIKE, TYPE_FUNC_NAME_KEYWORD},
- {"immediate", IMMEDIATE, UNRESERVED_KEYWORD},
- {"immutable", IMMUTABLE, UNRESERVED_KEYWORD},
- {"implicit", IMPLICIT_P, UNRESERVED_KEYWORD},
- {"in", IN_P, RESERVED_KEYWORD},
- {"including", INCLUDING, UNRESERVED_KEYWORD},
- {"increment", INCREMENT, UNRESERVED_KEYWORD},
- {"index", INDEX, UNRESERVED_KEYWORD},
- {"indexes", INDEXES, UNRESERVED_KEYWORD},
- {"inherit", INHERIT, UNRESERVED_KEYWORD},
- {"inherits", INHERITS, UNRESERVED_KEYWORD},
- {"initially", INITIALLY, RESERVED_KEYWORD},
- {"inner", INNER_P, TYPE_FUNC_NAME_KEYWORD},
- {"inout", INOUT, COL_NAME_KEYWORD},
- {"input", INPUT_P, UNRESERVED_KEYWORD},
- {"insensitive", INSENSITIVE, UNRESERVED_KEYWORD},
- {"insert", INSERT, UNRESERVED_KEYWORD},
- {"instead", INSTEAD, UNRESERVED_KEYWORD},
- {"int", INT_P, COL_NAME_KEYWORD},
- {"integer", INTEGER, COL_NAME_KEYWORD},
- {"intersect", INTERSECT, RESERVED_KEYWORD},
- {"interval", INTERVAL, COL_NAME_KEYWORD},
- {"into", INTO, RESERVED_KEYWORD},
- {"invoker", INVOKER, UNRESERVED_KEYWORD},
- {"is", IS, TYPE_FUNC_NAME_KEYWORD},
- {"isnull", ISNULL, TYPE_FUNC_NAME_KEYWORD},
- {"isolation", ISOLATION, UNRESERVED_KEYWORD},
- {"join", JOIN, TYPE_FUNC_NAME_KEYWORD},
- {"key", KEY, UNRESERVED_KEYWORD},
- {"lancompiler", LANCOMPILER, UNRESERVED_KEYWORD},
- {"language", LANGUAGE, UNRESERVED_KEYWORD},
- {"large", LARGE_P, UNRESERVED_KEYWORD},
- {"last", LAST_P, UNRESERVED_KEYWORD},
- {"leading", LEADING, RESERVED_KEYWORD},
- {"least", LEAST, COL_NAME_KEYWORD},
- {"left", LEFT, TYPE_FUNC_NAME_KEYWORD},
- {"level", LEVEL, UNRESERVED_KEYWORD},
- {"like", LIKE, TYPE_FUNC_NAME_KEYWORD},
- {"limit", LIMIT, RESERVED_KEYWORD},
- {"listen", LISTEN, UNRESERVED_KEYWORD},
- {"load", LOAD, UNRESERVED_KEYWORD},
- {"local", LOCAL, UNRESERVED_KEYWORD},
- {"localtime", LOCALTIME, RESERVED_KEYWORD},
- {"localtimestamp", LOCALTIMESTAMP, RESERVED_KEYWORD},
- {"location", LOCATION, UNRESERVED_KEYWORD},
- {"lock", LOCK_P, UNRESERVED_KEYWORD},
- {"log", LOG_P_GP, RESERVED_KEYWORD}, /* Greenplum Keyword */
- {"login", LOGIN_P, UNRESERVED_KEYWORD},
- {"long", LONG_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"mapping", MAPPING, UNRESERVED_KEYWORD},
- {"match", MATCH, UNRESERVED_KEYWORD},
- {"maxvalue", MAXVALUE, UNRESERVED_KEYWORD},
- {"minus", MINUS_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"minute", MINUTE_P, UNRESERVED_KEYWORD},
- {"minvalue", MINVALUE, UNRESERVED_KEYWORD},
- {"mode", MODE, UNRESERVED_KEYWORD},
- {"month", MONTH_P, UNRESERVED_KEYWORD},
- {"move", MOVE, UNRESERVED_KEYWORD},
- {"name", NAME_P, UNRESERVED_KEYWORD},
- {"names", NAMES, UNRESERVED_KEYWORD},
- {"national", NATIONAL, COL_NAME_KEYWORD},
- {"natural", NATURAL, TYPE_FUNC_NAME_KEYWORD},
- {"nchar", NCHAR, COL_NAME_KEYWORD},
- {"new", NEW, RESERVED_KEYWORD},
- {"next", NEXT, UNRESERVED_KEYWORD},
- {"no", NO, UNRESERVED_KEYWORD},
- {"nocache", NOCACHE_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"nocreatedb", NOCREATEDB, UNRESERVED_KEYWORD},
- {"nocreaterole", NOCREATEROLE, UNRESERVED_KEYWORD},
- {"nocreateuser", NOCREATEUSER, UNRESERVED_KEYWORD},
- {"noinherit", NOINHERIT, UNRESERVED_KEYWORD},
- {"nologin", NOLOGIN_P, UNRESERVED_KEYWORD},
- {"none", NONE, COL_NAME_KEYWORD},
- {"nosuperuser", NOSUPERUSER, UNRESERVED_KEYWORD},
- {"not", NOT, RESERVED_KEYWORD},
- {"nothing", NOTHING, UNRESERVED_KEYWORD},
- {"notify", NOTIFY, UNRESERVED_KEYWORD},
- {"notnull", NOTNULL, TYPE_FUNC_NAME_KEYWORD},
- {"nowait", NOWAIT, UNRESERVED_KEYWORD},
- {"null", NULL_P, RESERVED_KEYWORD},
- {"nullif", NULLIF, COL_NAME_KEYWORD},
- {"nulls", NULLS_P, UNRESERVED_KEYWORD},
- {"number", NUMBER_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"numeric", NUMERIC, COL_NAME_KEYWORD},
- {"object", OBJECT_P, UNRESERVED_KEYWORD},
- {"of", OF, UNRESERVED_KEYWORD},
- {"off", OFF, RESERVED_KEYWORD},
- {"offset", OFFSET, RESERVED_KEYWORD},
- {"oids", OIDS, UNRESERVED_KEYWORD},
- {"old", OLD, RESERVED_KEYWORD},
- {"on", ON, RESERVED_KEYWORD},
- {"only", ONLY, RESERVED_KEYWORD},
- {"operator", OPERATOR, UNRESERVED_KEYWORD},
- {"option", OPTION, UNRESERVED_KEYWORD},
- {"or", OR, RESERVED_KEYWORD},
- {"order", ORDER, RESERVED_KEYWORD},
- {"out", OUT_P, COL_NAME_KEYWORD},
- {"outer", OUTER_P, TYPE_FUNC_NAME_KEYWORD},
- {"overlaps", OVERLAPS, TYPE_FUNC_NAME_KEYWORD},
- {"overlay", OVERLAY, COL_NAME_KEYWORD},
- {"owned", OWNED, UNRESERVED_KEYWORD},
- {"owner", OWNER, UNRESERVED_KEYWORD},
- {"package", PACKAGE_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"parser", PARSER, UNRESERVED_KEYWORD},
- {"partial", PARTIAL, UNRESERVED_KEYWORD},
- {"password", PASSWORD, UNRESERVED_KEYWORD},
- {"placing", PLACING, RESERVED_KEYWORD},
- {"plans", PLANS, UNRESERVED_KEYWORD},
- {"pls_integer", PLS_INTEGER_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"position", POSITION, COL_NAME_KEYWORD},
- {"precision", PRECISION, COL_NAME_KEYWORD},
- {"prepare", PREPARE, UNRESERVED_KEYWORD},
- {"prepared", PREPARED, UNRESERVED_KEYWORD},
- {"preserve", PRESERVE, UNRESERVED_KEYWORD},
- {"primary", PRIMARY, RESERVED_KEYWORD},
- {"prior", PRIOR, UNRESERVED_KEYWORD},
- {"privileges", PRIVILEGES, UNRESERVED_KEYWORD},
- {"procedural", PROCEDURAL, UNRESERVED_KEYWORD},
- {"procedure", PROCEDURE, UNRESERVED_KEYWORD},
- {"quote", QUOTE, UNRESERVED_KEYWORD},
- {"raw", RAW_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"read", READ, UNRESERVED_KEYWORD},
- {"real", REAL, COL_NAME_KEYWORD},
- {"reassign", REASSIGN, UNRESERVED_KEYWORD},
- {"recheck", RECHECK, UNRESERVED_KEYWORD},
- {"references", REFERENCES, RESERVED_KEYWORD},
- {"reindex", REINDEX, UNRESERVED_KEYWORD},
- {"relative", RELATIVE_P, UNRESERVED_KEYWORD},
- {"release", RELEASE, UNRESERVED_KEYWORD},
- {"rename", RENAME, UNRESERVED_KEYWORD},
- {"repeatable", REPEATABLE, UNRESERVED_KEYWORD},
- {"replace", REPLACE, UNRESERVED_KEYWORD},
- {"replica", REPLICA, UNRESERVED_KEYWORD},
- {"reset", RESET, UNRESERVED_KEYWORD},
- {"restart", RESTART, UNRESERVED_KEYWORD},
- {"restrict", RESTRICT, UNRESERVED_KEYWORD},
- {"return", RETURN_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"returning", RETURNING, RESERVED_KEYWORD},
- {"returns", RETURNS, UNRESERVED_KEYWORD},
- {"revoke", REVOKE, UNRESERVED_KEYWORD},
- {"right", RIGHT, TYPE_FUNC_NAME_KEYWORD},
- {"role", ROLE, UNRESERVED_KEYWORD},
- {"rollback", ROLLBACK, UNRESERVED_KEYWORD},
- {"row", ROW, COL_NAME_KEYWORD},
- {"rows", ROWS, UNRESERVED_KEYWORD},
- {"rule", RULE, UNRESERVED_KEYWORD},
- {"savepoint", SAVEPOINT, UNRESERVED_KEYWORD},
- {"schema", SCHEMA, UNRESERVED_KEYWORD},
- {"scroll", SCROLL, UNRESERVED_KEYWORD},
- {"search", SEARCH, UNRESERVED_KEYWORD},
- {"second", SECOND_P, UNRESERVED_KEYWORD},
- {"security", SECURITY, UNRESERVED_KEYWORD},
- {"select", SELECT, RESERVED_KEYWORD},
- {"sequence", SEQUENCE, UNRESERVED_KEYWORD},
- {"serializable", SERIALIZABLE, UNRESERVED_KEYWORD},
- {"session", SESSION, UNRESERVED_KEYWORD},
- {"session_user", SESSION_USER, RESERVED_KEYWORD},
- {"set", SET, UNRESERVED_KEYWORD},
- {"setof", SETOF, COL_NAME_KEYWORD},
- {"share", SHARE, UNRESERVED_KEYWORD},
- {"show", SHOW, UNRESERVED_KEYWORD},
- {"similar", SIMILAR, TYPE_FUNC_NAME_KEYWORD},
- {"simple", SIMPLE, UNRESERVED_KEYWORD},
- {"smalldatetime", SMALLDATETIME_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"smallfloat", SMALLFLOAT_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"smallint", SMALLINT, COL_NAME_KEYWORD},
- {"smallmoney", SMALLMONEY_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"some", SOME, RESERVED_KEYWORD},
- {"stable", STABLE, UNRESERVED_KEYWORD},
- {"standalone", STANDALONE_P, UNRESERVED_KEYWORD},
- {"start", START, UNRESERVED_KEYWORD},
- {"statement", STATEMENT, UNRESERVED_KEYWORD},
- {"statistics", STATISTICS, UNRESERVED_KEYWORD},
- {"stdin", STDIN, UNRESERVED_KEYWORD},
- {"stdout", STDOUT, UNRESERVED_KEYWORD},
- {"storage", STORAGE, UNRESERVED_KEYWORD},
- {"strict", STRICT_P, UNRESERVED_KEYWORD},
- {"strip", STRIP_P, UNRESERVED_KEYWORD},
- {"substring", SUBSTRING, COL_NAME_KEYWORD},
- {"superuser", SUPERUSER_P, UNRESERVED_KEYWORD},
- {"symmetric", SYMMETRIC, RESERVED_KEYWORD},
- {"sysdate", SYSDATE_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"sysid", SYSID, UNRESERVED_KEYWORD},
- {"system", SYSTEM_P, UNRESERVED_KEYWORD},
- {"systimestamp", SYSTIMESTAMP_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"table", TABLE, RESERVED_KEYWORD},
- {"tablespace", TABLESPACE, UNRESERVED_KEYWORD},
- {"temp", TEMP, UNRESERVED_KEYWORD},
- {"template", TEMPLATE, UNRESERVED_KEYWORD},
- {"temporary", TEMPORARY, UNRESERVED_KEYWORD},
- {"text", TEXT_P, UNRESERVED_KEYWORD},
- {"then", THEN, RESERVED_KEYWORD},
- {"time", TIME, COL_NAME_KEYWORD},
- {"timestamp", TIMESTAMP, COL_NAME_KEYWORD},
- {"tinyint", TINYINT_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"tinytext", TINYTEXT_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"to", TO, RESERVED_KEYWORD},
- {"trailing", TRAILING, RESERVED_KEYWORD},
- {"transaction", TRANSACTION, UNRESERVED_KEYWORD},
- {"treat", TREAT, COL_NAME_KEYWORD},
- {"trigger", TRIGGER, UNRESERVED_KEYWORD},
- {"trim", TRIM, COL_NAME_KEYWORD},
- {"true", TRUE_P, RESERVED_KEYWORD},
- {"truncate", TRUNCATE, UNRESERVED_KEYWORD},
- {"trusted", TRUSTED, UNRESERVED_KEYWORD},
- {"type", TYPE_P, UNRESERVED_KEYWORD},
- {"uncommitted", UNCOMMITTED, UNRESERVED_KEYWORD},
- {"unencrypted", UNENCRYPTED, UNRESERVED_KEYWORD},
- {"union", UNION, RESERVED_KEYWORD},
- {"unique", UNIQUE, RESERVED_KEYWORD},
- {"unknown", UNKNOWN, UNRESERVED_KEYWORD},
- {"unlisten", UNLISTEN, UNRESERVED_KEYWORD},
- {"until", UNTIL, UNRESERVED_KEYWORD},
- {"update", UPDATE, UNRESERVED_KEYWORD},
- {"user", USER, RESERVED_KEYWORD},
- {"using", USING, RESERVED_KEYWORD},
- {"vacuum", VACUUM, UNRESERVED_KEYWORD},
- {"valid", VALID, UNRESERVED_KEYWORD},
- {"validator", VALIDATOR, UNRESERVED_KEYWORD},
- {"value", VALUE_P, UNRESERVED_KEYWORD},
- {"values", VALUES, COL_NAME_KEYWORD},
- {"varchar", VARCHAR, COL_NAME_KEYWORD},
- {"varchar2", VARCHAR2_EDB, RESERVED_KEYWORD}, /* EnterpriseDB Keyword */
- {"varying", VARYING, UNRESERVED_KEYWORD},
- {"verbose", VERBOSE, TYPE_FUNC_NAME_KEYWORD},
- {"version", VERSION_P, UNRESERVED_KEYWORD},
- {"view", VIEW, UNRESERVED_KEYWORD},
- {"volatile", VOLATILE, UNRESERVED_KEYWORD},
- {"when", WHEN, RESERVED_KEYWORD},
- {"where", WHERE, RESERVED_KEYWORD},
- {"whitespace", WHITESPACE_P, UNRESERVED_KEYWORD},
-
- /*
- * XXX we mark WITH as reserved to force it to be quoted in dumps, even
- * though it is currently unreserved according to gram.y. This is because
- * we expect we'll have to make it reserved to implement SQL WITH clauses.
- * If that patch manages to do without reserving WITH, adjust this entry
- * at that time; in any case this should be back in sync with gram.y after
- * WITH clauses are implemented.
- */
- {"window", WINDOW, RESERVED_KEYWORD},
- {"with", WITH, RESERVED_KEYWORD},
- {"without", WITHOUT, UNRESERVED_KEYWORD},
- {"work", WORK, UNRESERVED_KEYWORD},
- {"write", WRITE, UNRESERVED_KEYWORD},
- {"xml", XML_P, UNRESERVED_KEYWORD},
- {"xmlattributes", XMLATTRIBUTES, COL_NAME_KEYWORD},
- {"xmlconcat", XMLCONCAT, COL_NAME_KEYWORD},
- {"xmlelement", XMLELEMENT, COL_NAME_KEYWORD},
- {"xmlforest", XMLFOREST, COL_NAME_KEYWORD},
- {"xmlparse", XMLPARSE, COL_NAME_KEYWORD},
- {"xmlpi", XMLPI, COL_NAME_KEYWORD},
- {"xmlroot", XMLROOT, COL_NAME_KEYWORD},
- {"xmlserialize", XMLSERIALIZE, COL_NAME_KEYWORD},
- {"year", YEAR_P, UNRESERVED_KEYWORD},
- {"yes", YES_P, UNRESERVED_KEYWORD},
- {"zone", ZONE, UNRESERVED_KEYWORD},
+const ScanKeyword ScanKeywordsExtra[] = {
+ PG_KEYWORD("connect", CONNECT_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("convert", CONVERT_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("distributed", DISTRIBUTED_GP, UNRESERVED_KEYWORD)
+ PG_KEYWORD("exec", EXEC_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("log", LOG_P_GP, UNRESERVED_KEYWORD)
+ PG_KEYWORD("long", LONG_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("minus", MINUS_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("nocache", NOCACHE_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("number", NUMBER_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("package", PACKAGE_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("pls_integer", PLS_INTEGER_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("raw", RAW_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("return", RETURN_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("smalldatetime", SMALLDATETIME_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("smallfloat", SMALLFLOAT_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("smallmoney", SMALLMONEY_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("sysdate", SYSDATE_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("systimestap", SYSTIMESTAMP_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("tinyint", TINYINT_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("tinytext", TINYTEXT_EDB, RESERVED_KEYWORD)
+ PG_KEYWORD("varchar2", VARCHAR2_EDB, RESERVED_KEYWORD)
};
+const int NumScanKeywordsExtra = lengthof(ScanKeywordsExtra);
/*
* ScanKeywordLookup - see if a given word is a keyword
@@ -512,5 +166,26 @@ ScanKeywordLookup(const char *text)
high = middle - 1;
}
+ /*
+ * If not found, also do a binary search in the list of extra
+ * keywords.
+ */
+ low = &ScanKeywordsExtra[0];
+ high = endof(ScanKeywordsExtra) - 1;
+ while (low <= high)
+ {
+ const ScanKeyword *middle;
+ int difference;
+
+ middle = low + (high - low) / 2;
+ difference = strcmp(middle->name, word);
+ if (difference == 0)
+ return middle;
+ else if (difference < 0)
+ low = middle + 1;
+ else
+ high = middle - 1;
+ }
+
return NULL;
}
diff --git a/pgadmin/include/parser/keywords.h b/pgadmin/include/parser/keywords.h
index 9cb842d..b9c0a33 100644
--- a/pgadmin/include/parser/keywords.h
+++ b/pgadmin/include/parser/keywords.h
@@ -15,10 +15,7 @@
///////////////////////////////////////////////////////////////////////////
//
// pgAdmin note: This file is based on src/include/parser/keywords.h from
-// PostgreSQL. It should be periodically updated to include
-// new keywords. struct ScanKeyword and the declaration of
-// ScanKeywordLookup originate in this file, whilst the enum
-// yytokentype is copied from src/include/parser/parse.h
+// PostgreSQL.
//
// This file is under the BSD licence, per PostgreSQL.
///////////////////////////////////////////////////////////////////////////
@@ -41,443 +38,8 @@ typedef struct ScanKeyword
extern const ScanKeyword *ScanKeywordLookup(const char *text);
-/* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
-
-/* PGADMIN NOTE:
- * There are a number of EnterpriseDB tokens added to the end of this list!!
- */
-
-enum yytokentype {
- ABORT_P = 258,
- ABSOLUTE_P = 259,
- ACCESS = 260,
- ACTION = 261,
- ADD_P = 262,
- ADMIN = 263,
- AFTER = 264,
- AGGREGATE = 265,
- ALL = 266,
- ALSO = 267,
- ALTER = 268,
- ALWAYS = 269,
- ANALYSE = 270,
- ANALYZE = 271,
- AND = 272,
- ANY = 273,
- ARRAY = 274,
- AS = 275,
- ASC = 276,
- ASSERTION = 277,
- ASSIGNMENT = 278,
- ASYMMETRIC = 279,
- AT = 280,
- AUTHORIZATION = 281,
- BACKWARD = 282,
- BEFORE = 283,
- BEGIN_P = 284,
- BETWEEN = 285,
- BIGINT = 286,
- BINARY = 287,
- BIT = 288,
- BOOLEAN_P = 289,
- BOTH = 290,
- BY = 291,
- CACHE = 292,
- CALLED = 293,
- CASCADE = 294,
- CASCADED = 295,
- CASE = 296,
- CAST = 297,
- CHAIN = 298,
- CHAR_P = 299,
- CHARACTER = 300,
- CHARACTERISTICS = 301,
- CHECK = 302,
- CHECKPOINT = 303,
- CLASS = 304,
- CLOSE = 305,
- CLUSTER = 306,
- COALESCE = 307,
- COLLATE = 308,
- COLUMN = 309,
- COMMENT = 310,
- COMMIT = 311,
- COMMITTED = 312,
- CONCURRENTLY = 313,
- CONFIGURATION = 314,
- CONNECTION = 315,
- CONSTRAINT = 316,
- CONSTRAINTS = 317,
- CONTENT_P = 318,
- CONVERSION_P = 319,
- COPY = 320,
- COST = 321,
- CREATE = 322,
- CREATEDB = 323,
- CREATEROLE = 324,
- CREATEUSER = 325,
- CROSS = 326,
- CSV = 327,
- CURRENT_P = 328,
- CURRENT_DATE = 329,
- CURRENT_ROLE = 330,
- CURRENT_TIME = 331,
- CURRENT_TIMESTAMP = 332,
- CURRENT_USER = 333,
- CURSOR = 334,
- CYCLE = 335,
- DATABASE = 336,
- DAY_P = 337,
- DEALLOCATE = 338,
- DEC = 339,
- DECIMAL_P = 340,
- DECLARE = 341,
- DEFAULT = 342,
- DEFAULTS = 343,
- DEFERRABLE = 344,
- DEFERRED = 345,
- DEFINER = 346,
- DELETE_P = 347,
- DELIMITER = 348,
- DELIMITERS = 349,
- DESC = 350,
- DICTIONARY = 351,
- DISABLE_P = 352,
- DISCARD = 353,
- DISTINCT = 354,
- DO = 355,
- DOCUMENT_P = 356,
- DOMAIN_P = 357,
- DOUBLE_P = 358,
- DROP = 359,
- EACH = 360,
- ELSE = 361,
- ENABLE_P = 362,
- ENCODING = 363,
- ENCRYPTED = 364,
- END_P = 365,
- ENUM_P = 366,
- ESCAPE = 367,
- EXCEPT = 368,
- EXCLUDING = 369,
- EXCLUSIVE = 370,
- EXECUTE = 371,
- EXISTS = 372,
- EXPLAIN = 373,
- EXTERNAL = 374,
- EXTRACT = 375,
- FALSE_P = 376,
- FAMILY = 377,
- FETCH = 378,
- FIRST_P = 379,
- FLOAT_P = 380,
- FOR = 381,
- FORCE = 382,
- FOREIGN = 383,
- FORWARD = 384,
- FREEZE = 385,
- FROM = 386,
- FULL = 387,
- FUNCTION = 388,
- GLOBAL = 389,
- GRANT = 390,
- GRANTED = 391,
- GREATEST = 392,
- GROUP_P = 393,
- HANDLER = 394,
- HAVING = 395,
- HEADER_P = 396,
- HOLD = 397,
- HOUR_P = 398,
- IF_P = 399,
- ILIKE = 400,
- IMMEDIATE = 401,
- IMMUTABLE = 402,
- IMPLICIT_P = 403,
- IN_P = 404,
- INCLUDING = 405,
- INCREMENT = 406,
- INDEX = 407,
- INDEXES = 408,
- INHERIT = 409,
- INHERITS = 410,
- INITIALLY = 411,
- INNER_P = 412,
- INOUT = 413,
- INPUT_P = 414,
- INSENSITIVE = 415,
- INSERT = 416,
- INSTEAD = 417,
- INT_P = 418,
- INTEGER = 419,
- INTERSECT = 420,
- INTERVAL = 421,
- INTO = 422,
- INVOKER = 423,
- IS = 424,
- ISNULL = 425,
- ISOLATION = 426,
- JOIN = 427,
- KEY = 428,
- LANCOMPILER = 429,
- LANGUAGE = 430,
- LARGE_P = 431,
- LAST_P = 432,
- LEADING = 433,
- LEAST = 434,
- LEFT = 435,
- LEVEL = 436,
- LIKE = 437,
- LIMIT = 438,
- LISTEN = 439,
- LOAD = 440,
- LOCAL = 441,
- LOCALTIME = 442,
- LOCALTIMESTAMP = 443,
- LOCATION = 444,
- LOCK_P = 445,
- LOGIN_P = 446,
- MAPPING = 447,
- MATCH = 448,
- MAXVALUE = 449,
- MINUTE_P = 450,
- MINVALUE = 451,
- MODE = 452,
- MONTH_P = 453,
- MOVE = 454,
- NAME_P = 455,
- NAMES = 456,
- NATIONAL = 457,
- NATURAL = 458,
- NCHAR = 459,
- NEW = 460,
- NEXT = 461,
- NO = 462,
- NOCREATEDB = 463,
- NOCREATEROLE = 464,
- NOCREATEUSER = 465,
- NOINHERIT = 466,
- NOLOGIN_P = 467,
- NONE = 468,
- NOSUPERUSER = 469,
- NOT = 470,
- NOTHING = 471,
- NOTIFY = 472,
- NOTNULL = 473,
- NOWAIT = 474,
- NULL_P = 475,
- NULLIF = 476,
- NULLS_P = 477,
- NUMERIC = 478,
- OBJECT_P = 479,
- OF = 480,
- OFF = 481,
- OFFSET = 482,
- OIDS = 483,
- OLD = 484,
- ON = 485,
- ONLY = 486,
- OPERATOR = 487,
- OPTION = 488,
- OR = 489,
- ORDER = 490,
- OUT_P = 491,
- OUTER_P = 492,
- OVERLAPS = 493,
- OVERLAY = 494,
- OWNED = 495,
- OWNER = 496,
- PARSER = 497,
- PARTIAL = 498,
- PASSWORD = 499,
- PLACING = 500,
- PLANS = 501,
- POSITION = 502,
- PRECISION = 503,
- PRESERVE = 504,
- PREPARE = 505,
- PREPARED = 506,
- PRIMARY = 507,
- PRIOR = 508,
- PRIVILEGES = 509,
- PROCEDURAL = 510,
- PROCEDURE = 511,
- QUOTE = 512,
- READ = 513,
- REAL = 514,
- REASSIGN = 515,
- RECHECK = 516,
- REFERENCES = 517,
- REINDEX = 518,
- RELATIVE_P = 519,
- RELEASE = 520,
- RENAME = 521,
- REPEATABLE = 522,
- REPLACE = 523,
- REPLICA = 524,
- RESET = 525,
- RESTART = 526,
- RESTRICT = 527,
- RETURNING = 528,
- RETURNS = 529,
- REVOKE = 530,
- RIGHT = 531,
- ROLE = 532,
- ROLLBACK = 533,
- ROW = 534,
- ROWS = 535,
- RULE = 536,
- SAVEPOINT = 537,
- SCHEMA = 538,
- SCROLL = 539,
- SEARCH = 540,
- SECOND_P = 541,
- SECURITY = 542,
- SELECT = 543,
- SEQUENCE = 544,
- SERIALIZABLE = 545,
- SESSION = 546,
- SESSION_USER = 547,
- SET = 548,
- SETOF = 549,
- SHARE = 550,
- SHOW = 551,
- SIMILAR = 552,
- SIMPLE = 553,
- SMALLINT = 554,
- SOME = 555,
- STABLE = 556,
- STANDALONE_P = 557,
- START = 558,
- STATEMENT = 559,
- STATISTICS = 560,
- STDIN = 561,
- STDOUT = 562,
- STORAGE = 563,
- STRICT_P = 564,
- STRIP_P = 565,
- SUBSTRING = 566,
- SUPERUSER_P = 567,
- SYMMETRIC = 568,
- SYSID = 569,
- SYSTEM_P = 570,
- TABLE = 571,
- TABLESPACE = 572,
- TEMP = 573,
- TEMPLATE = 574,
- TEMPORARY = 575,
- TEXT_P = 576,
- THEN = 577,
- TIME = 578,
- TIMESTAMP = 579,
- TO = 580,
- TRAILING = 581,
- TRANSACTION = 582,
- TREAT = 583,
- TRIGGER = 584,
- TRIM = 585,
- TRUE_P = 586,
- TRUNCATE = 587,
- TRUSTED = 588,
- TYPE_P = 589,
- UNCOMMITTED = 590,
- UNENCRYPTED = 591,
- UNION = 592,
- UNIQUE = 593,
- UNKNOWN = 594,
- UNLISTEN = 595,
- UNTIL = 596,
- UPDATE = 597,
- USER = 598,
- USING = 599,
- VACUUM = 600,
- VALID = 601,
- VALIDATOR = 602,
- VALUE_P = 603,
- VALUES = 604,
- VARCHAR = 605,
- VARYING = 606,
- VERBOSE = 607,
- VERSION_P = 608,
- VIEW = 609,
- VOLATILE = 610,
- WHEN = 611,
- WHERE = 612,
- WHITESPACE_P = 613,
- WITH = 614,
- WITHOUT = 615,
- WORK = 616,
- WRITE = 617,
- XML_P = 618,
- XMLATTRIBUTES = 619,
- XMLCONCAT = 620,
- XMLELEMENT = 621,
- XMLFOREST = 622,
- XMLPARSE = 623,
- XMLPI = 624,
- XMLROOT = 625,
- XMLSERIALIZE = 626,
- YEAR_P = 627,
- YES_P = 628,
- ZONE = 629,
- NULLS_FIRST = 630,
- NULLS_LAST = 631,
- WITH_CASCADED = 632,
- WITH_LOCAL = 633,
- WITH_CHECK = 634,
- IDENT = 635,
- FCONST = 636,
- SCONST = 637,
- BCONST = 638,
- XCONST = 639,
- Op = 640,
- ICONST = 641,
- PARAM = 642,
- POSTFIXOP = 643,
- UMINUS = 644,
- TYPECAST = 645,
- CTYPE=646,
- WINDOW=647,
-
- /* The following additions are unreserved keywords for autovacuum settings */
- AUTOVACUUM_E=700,
- AUTOVACUUM_V_TH=701,
- AUTOVACUUM_A_TH=702,
- AUTOVACUUM_V_SC_F=703,
- AUTOVACUUM_A_SC_F=704,
- AUTOVACUUM_V_COST_D=705,
- AUTOVACUUM_V_COST_L=705,
- AUTOVACUUM_F_MIN_AGE=706,
- AUTOVACUUM_F_MAX_AGE=707,
- AUTOVACUUM_F_TBL_AGE=707,
- FILLFACTOR=707,
-
- /* The following additions are keywords in EnterpriseDB */
- CONNECT_EDB = 800,
- CONVERT_EDB = 801,
- MINUS_EDB = 802,
- NUMBER_EDB = 803,
- PACKAGE_EDB = 804,
- SMALLDATETIME_EDB = 805,
- SMALLFLOAT_EDB = 806,
- SMALLMONEY_EDB = 807,
- TINYINT_EDB = 808,
- TINYTEXT_EDB = 809,
- VARCHAR2_EDB = 810,
- EXEC_EDB = 811,
- LONG_EDB = 812,
- NOCACHE_EDB = 813,
- PLS_INTEGER_EDB = 814,
- RAW_EDB = 815,
- RETURN_EDB = 816,
- SYSDATE_EDB = 817,
- SYSTIMESTAMP_EDB = 818,
-
- /* The following additions are keywords in Greenplum Database */
- DISTRIBUTED_GP = 900,
- LOG_P_GP = 901
-
-};
-
+extern const ScanKeyword ScanKeywords[];
+extern const ScanKeyword ScanKeywordsExtra[];
+extern const int NumScanKeywords;
+extern const int NumScanKeywordsExtra;
#endif /* KEYWORDS_H */
diff --git a/pgadmin/utils/misc.cpp b/pgadmin/utils/misc.cpp
index f64e48e..8ebb4f4 100644
--- a/pgadmin/utils/misc.cpp
+++ b/pgadmin/utils/misc.cpp
@@ -307,16 +307,16 @@ wxString qtDbStringDollar(const wxString &value)
void FillKeywords(wxString &str)
{
// unfortunately, the keyword list is static.
- // If the first or the last word change, these both need to get updated.
- const ScanKeyword *keyword=ScanKeywordLookup("abort");
- const ScanKeyword *last=ScanKeywordLookup("zone");
+ int i;
- wxASSERT(keyword && last);
+ str = wxString();
- str = wxString::FromAscii(keyword->name);
-
- while (keyword++ < last)
- str += wxT(" ") + wxString::FromAscii(keyword->name);
+ for (i = 0; i < NumScanKeywords; i++) {
+ str += wxT(" ") + wxString::FromAscii(ScanKeywords[i].name);
+ }
+ for (i = 0; i < NumScanKeywordsExtra; i++) {
+ str += wxT(" ") + wxString::FromAscii(ScanKeywordsExtra[i].name);
+ }
}
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers