Skip to content

Commit

Permalink
Make COPY statement options compliant to Postgres (#247)
Browse files Browse the repository at this point in the history
Add brackets around the options to make the `COPY` statement compliant to Postgres again and add the encoding as another option.
  • Loading branch information
dey4ss authored Sep 17, 2024
1 parent 9a67d24 commit 57c763a
Show file tree
Hide file tree
Showing 14 changed files with 4,728 additions and 4,521 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ relaxed_build ?= "off"
ifeq ($(relaxed_build), on)
$(warning $(NAME) will be built with most compiler warnings deactivated. This is fine if you want to test $(NAME) but will become an issue when you want to contribute code.)
else
LIB_CLFAGS += -Wall -Werror
LIB_CFLAGS += -Wall -Werror
endif

static ?= no
Expand All @@ -66,8 +66,11 @@ library: $(LIB_BUILD)
$(LIB_BUILD): $(LIB_OBJ)
$(LIBLINKER) $(LIB_LFLAGS) $(LIB_BUILD) $(LIB_OBJ)

# The auto-generated code from bison and flex contains some parts the compiler complains about with -Wall.
$(SRCPARSER)/flex_lexer.o: $(SRCPARSER)/flex_lexer.cpp $(SRCPARSER)/bison_parser.cpp
$(CXX) $(LIB_CFLAGS) -c -o $@ $< -Wno-sign-compare -Wno-unneeded-internal-declaration -Wno-register
$(SRCPARSER)/bison_parser.o: $(SRCPARSER)/bison_parser.cpp
$(CXX) $(LIB_CFLAGS) -c -o $@ $< -Wno-unused-but-set-variable

%.o: %.cpp $(PARSER_CPP) $(LIB_H)
$(CXX) $(LIB_CFLAGS) -c -o $@ $<
Expand Down
4,010 changes: 2,051 additions & 1,959 deletions src/parser/bison_parser.cpp

Large diffs are not rendered by default.

315 changes: 159 additions & 156 deletions src/parser/bison_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,161 +108,162 @@ extern int hsql_debug;
SQL_DEFAULT = 276, /* DEFAULT */
SQL_EXECUTE = 277, /* EXECUTE */
SQL_EXPLAIN = 278, /* EXPLAIN */
SQL_INTEGER = 279, /* INTEGER */
SQL_NATURAL = 280, /* NATURAL */
SQL_PREPARE = 281, /* PREPARE */
SQL_PRIMARY = 282, /* PRIMARY */
SQL_SCHEMAS = 283, /* SCHEMAS */
SQL_CHARACTER_VARYING = 284, /* CHARACTER_VARYING */
SQL_REAL = 285, /* REAL */
SQL_DECIMAL = 286, /* DECIMAL */
SQL_SMALLINT = 287, /* SMALLINT */
SQL_BIGINT = 288, /* BIGINT */
SQL_SPATIAL = 289, /* SPATIAL */
SQL_VARCHAR = 290, /* VARCHAR */
SQL_VIRTUAL = 291, /* VIRTUAL */
SQL_DESCRIBE = 292, /* DESCRIBE */
SQL_BEFORE = 293, /* BEFORE */
SQL_COLUMN = 294, /* COLUMN */
SQL_CREATE = 295, /* CREATE */
SQL_DELETE = 296, /* DELETE */
SQL_DIRECT = 297, /* DIRECT */
SQL_DOUBLE = 298, /* DOUBLE */
SQL_ESCAPE = 299, /* ESCAPE */
SQL_EXCEPT = 300, /* EXCEPT */
SQL_EXISTS = 301, /* EXISTS */
SQL_EXTRACT = 302, /* EXTRACT */
SQL_CAST = 303, /* CAST */
SQL_FORMAT = 304, /* FORMAT */
SQL_GLOBAL = 305, /* GLOBAL */
SQL_HAVING = 306, /* HAVING */
SQL_IMPORT = 307, /* IMPORT */
SQL_INSERT = 308, /* INSERT */
SQL_ISNULL = 309, /* ISNULL */
SQL_OFFSET = 310, /* OFFSET */
SQL_RENAME = 311, /* RENAME */
SQL_SCHEMA = 312, /* SCHEMA */
SQL_SELECT = 313, /* SELECT */
SQL_SORTED = 314, /* SORTED */
SQL_TABLES = 315, /* TABLES */
SQL_UNIQUE = 316, /* UNIQUE */
SQL_UNLOAD = 317, /* UNLOAD */
SQL_UPDATE = 318, /* UPDATE */
SQL_VALUES = 319, /* VALUES */
SQL_AFTER = 320, /* AFTER */
SQL_ALTER = 321, /* ALTER */
SQL_CROSS = 322, /* CROSS */
SQL_DELTA = 323, /* DELTA */
SQL_FLOAT = 324, /* FLOAT */
SQL_GROUP = 325, /* GROUP */
SQL_INDEX = 326, /* INDEX */
SQL_INNER = 327, /* INNER */
SQL_LIMIT = 328, /* LIMIT */
SQL_LOCAL = 329, /* LOCAL */
SQL_MERGE = 330, /* MERGE */
SQL_MINUS = 331, /* MINUS */
SQL_ORDER = 332, /* ORDER */
SQL_OVER = 333, /* OVER */
SQL_OUTER = 334, /* OUTER */
SQL_RIGHT = 335, /* RIGHT */
SQL_TABLE = 336, /* TABLE */
SQL_UNION = 337, /* UNION */
SQL_USING = 338, /* USING */
SQL_WHERE = 339, /* WHERE */
SQL_CALL = 340, /* CALL */
SQL_CASE = 341, /* CASE */
SQL_CHAR = 342, /* CHAR */
SQL_COPY = 343, /* COPY */
SQL_DATE = 344, /* DATE */
SQL_DATETIME = 345, /* DATETIME */
SQL_DESC = 346, /* DESC */
SQL_DROP = 347, /* DROP */
SQL_ELSE = 348, /* ELSE */
SQL_FILE = 349, /* FILE */
SQL_FROM = 350, /* FROM */
SQL_FULL = 351, /* FULL */
SQL_HASH = 352, /* HASH */
SQL_HINT = 353, /* HINT */
SQL_INTO = 354, /* INTO */
SQL_JOIN = 355, /* JOIN */
SQL_LEFT = 356, /* LEFT */
SQL_LIKE = 357, /* LIKE */
SQL_LOAD = 358, /* LOAD */
SQL_LONG = 359, /* LONG */
SQL_NULL = 360, /* NULL */
SQL_PARTITION = 361, /* PARTITION */
SQL_PLAN = 362, /* PLAN */
SQL_SHOW = 363, /* SHOW */
SQL_TEXT = 364, /* TEXT */
SQL_THEN = 365, /* THEN */
SQL_TIME = 366, /* TIME */
SQL_VIEW = 367, /* VIEW */
SQL_WHEN = 368, /* WHEN */
SQL_WITH = 369, /* WITH */
SQL_ADD = 370, /* ADD */
SQL_ALL = 371, /* ALL */
SQL_AND = 372, /* AND */
SQL_ASC = 373, /* ASC */
SQL_END = 374, /* END */
SQL_FOR = 375, /* FOR */
SQL_INT = 376, /* INT */
SQL_KEY = 377, /* KEY */
SQL_NOT = 378, /* NOT */
SQL_OFF = 379, /* OFF */
SQL_SET = 380, /* SET */
SQL_TOP = 381, /* TOP */
SQL_AS = 382, /* AS */
SQL_BY = 383, /* BY */
SQL_IF = 384, /* IF */
SQL_IN = 385, /* IN */
SQL_IS = 386, /* IS */
SQL_OF = 387, /* OF */
SQL_ON = 388, /* ON */
SQL_OR = 389, /* OR */
SQL_TO = 390, /* TO */
SQL_NO = 391, /* NO */
SQL_ARRAY = 392, /* ARRAY */
SQL_CONCAT = 393, /* CONCAT */
SQL_ILIKE = 394, /* ILIKE */
SQL_SECOND = 395, /* SECOND */
SQL_MINUTE = 396, /* MINUTE */
SQL_HOUR = 397, /* HOUR */
SQL_DAY = 398, /* DAY */
SQL_MONTH = 399, /* MONTH */
SQL_YEAR = 400, /* YEAR */
SQL_SECONDS = 401, /* SECONDS */
SQL_MINUTES = 402, /* MINUTES */
SQL_HOURS = 403, /* HOURS */
SQL_DAYS = 404, /* DAYS */
SQL_MONTHS = 405, /* MONTHS */
SQL_YEARS = 406, /* YEARS */
SQL_INTERVAL = 407, /* INTERVAL */
SQL_TRUE = 408, /* TRUE */
SQL_FALSE = 409, /* FALSE */
SQL_BOOLEAN = 410, /* BOOLEAN */
SQL_TRANSACTION = 411, /* TRANSACTION */
SQL_BEGIN = 412, /* BEGIN */
SQL_COMMIT = 413, /* COMMIT */
SQL_ROLLBACK = 414, /* ROLLBACK */
SQL_NOWAIT = 415, /* NOWAIT */
SQL_SKIP = 416, /* SKIP */
SQL_LOCKED = 417, /* LOCKED */
SQL_SHARE = 418, /* SHARE */
SQL_RANGE = 419, /* RANGE */
SQL_ROWS = 420, /* ROWS */
SQL_GROUPS = 421, /* GROUPS */
SQL_UNBOUNDED = 422, /* UNBOUNDED */
SQL_FOLLOWING = 423, /* FOLLOWING */
SQL_PRECEDING = 424, /* PRECEDING */
SQL_CURRENT_ROW = 425, /* CURRENT_ROW */
SQL_EQUALS = 426, /* EQUALS */
SQL_NOTEQUALS = 427, /* NOTEQUALS */
SQL_LESS = 428, /* LESS */
SQL_GREATER = 429, /* GREATER */
SQL_LESSEQ = 430, /* LESSEQ */
SQL_GREATEREQ = 431, /* GREATEREQ */
SQL_NOTNULL = 432, /* NOTNULL */
SQL_UMINUS = 433 /* UMINUS */
SQL_ENCODING = 279, /* ENCODING */
SQL_INTEGER = 280, /* INTEGER */
SQL_NATURAL = 281, /* NATURAL */
SQL_PREPARE = 282, /* PREPARE */
SQL_PRIMARY = 283, /* PRIMARY */
SQL_SCHEMAS = 284, /* SCHEMAS */
SQL_CHARACTER_VARYING = 285, /* CHARACTER_VARYING */
SQL_REAL = 286, /* REAL */
SQL_DECIMAL = 287, /* DECIMAL */
SQL_SMALLINT = 288, /* SMALLINT */
SQL_BIGINT = 289, /* BIGINT */
SQL_SPATIAL = 290, /* SPATIAL */
SQL_VARCHAR = 291, /* VARCHAR */
SQL_VIRTUAL = 292, /* VIRTUAL */
SQL_DESCRIBE = 293, /* DESCRIBE */
SQL_BEFORE = 294, /* BEFORE */
SQL_COLUMN = 295, /* COLUMN */
SQL_CREATE = 296, /* CREATE */
SQL_DELETE = 297, /* DELETE */
SQL_DIRECT = 298, /* DIRECT */
SQL_DOUBLE = 299, /* DOUBLE */
SQL_ESCAPE = 300, /* ESCAPE */
SQL_EXCEPT = 301, /* EXCEPT */
SQL_EXISTS = 302, /* EXISTS */
SQL_EXTRACT = 303, /* EXTRACT */
SQL_CAST = 304, /* CAST */
SQL_FORMAT = 305, /* FORMAT */
SQL_GLOBAL = 306, /* GLOBAL */
SQL_HAVING = 307, /* HAVING */
SQL_IMPORT = 308, /* IMPORT */
SQL_INSERT = 309, /* INSERT */
SQL_ISNULL = 310, /* ISNULL */
SQL_OFFSET = 311, /* OFFSET */
SQL_RENAME = 312, /* RENAME */
SQL_SCHEMA = 313, /* SCHEMA */
SQL_SELECT = 314, /* SELECT */
SQL_SORTED = 315, /* SORTED */
SQL_TABLES = 316, /* TABLES */
SQL_UNIQUE = 317, /* UNIQUE */
SQL_UNLOAD = 318, /* UNLOAD */
SQL_UPDATE = 319, /* UPDATE */
SQL_VALUES = 320, /* VALUES */
SQL_AFTER = 321, /* AFTER */
SQL_ALTER = 322, /* ALTER */
SQL_CROSS = 323, /* CROSS */
SQL_DELTA = 324, /* DELTA */
SQL_FLOAT = 325, /* FLOAT */
SQL_GROUP = 326, /* GROUP */
SQL_INDEX = 327, /* INDEX */
SQL_INNER = 328, /* INNER */
SQL_LIMIT = 329, /* LIMIT */
SQL_LOCAL = 330, /* LOCAL */
SQL_MERGE = 331, /* MERGE */
SQL_MINUS = 332, /* MINUS */
SQL_ORDER = 333, /* ORDER */
SQL_OVER = 334, /* OVER */
SQL_OUTER = 335, /* OUTER */
SQL_RIGHT = 336, /* RIGHT */
SQL_TABLE = 337, /* TABLE */
SQL_UNION = 338, /* UNION */
SQL_USING = 339, /* USING */
SQL_WHERE = 340, /* WHERE */
SQL_CALL = 341, /* CALL */
SQL_CASE = 342, /* CASE */
SQL_CHAR = 343, /* CHAR */
SQL_COPY = 344, /* COPY */
SQL_DATE = 345, /* DATE */
SQL_DATETIME = 346, /* DATETIME */
SQL_DESC = 347, /* DESC */
SQL_DROP = 348, /* DROP */
SQL_ELSE = 349, /* ELSE */
SQL_FILE = 350, /* FILE */
SQL_FROM = 351, /* FROM */
SQL_FULL = 352, /* FULL */
SQL_HASH = 353, /* HASH */
SQL_HINT = 354, /* HINT */
SQL_INTO = 355, /* INTO */
SQL_JOIN = 356, /* JOIN */
SQL_LEFT = 357, /* LEFT */
SQL_LIKE = 358, /* LIKE */
SQL_LOAD = 359, /* LOAD */
SQL_LONG = 360, /* LONG */
SQL_NULL = 361, /* NULL */
SQL_PARTITION = 362, /* PARTITION */
SQL_PLAN = 363, /* PLAN */
SQL_SHOW = 364, /* SHOW */
SQL_TEXT = 365, /* TEXT */
SQL_THEN = 366, /* THEN */
SQL_TIME = 367, /* TIME */
SQL_VIEW = 368, /* VIEW */
SQL_WHEN = 369, /* WHEN */
SQL_WITH = 370, /* WITH */
SQL_ADD = 371, /* ADD */
SQL_ALL = 372, /* ALL */
SQL_AND = 373, /* AND */
SQL_ASC = 374, /* ASC */
SQL_END = 375, /* END */
SQL_FOR = 376, /* FOR */
SQL_INT = 377, /* INT */
SQL_KEY = 378, /* KEY */
SQL_NOT = 379, /* NOT */
SQL_OFF = 380, /* OFF */
SQL_SET = 381, /* SET */
SQL_TOP = 382, /* TOP */
SQL_AS = 383, /* AS */
SQL_BY = 384, /* BY */
SQL_IF = 385, /* IF */
SQL_IN = 386, /* IN */
SQL_IS = 387, /* IS */
SQL_OF = 388, /* OF */
SQL_ON = 389, /* ON */
SQL_OR = 390, /* OR */
SQL_TO = 391, /* TO */
SQL_NO = 392, /* NO */
SQL_ARRAY = 393, /* ARRAY */
SQL_CONCAT = 394, /* CONCAT */
SQL_ILIKE = 395, /* ILIKE */
SQL_SECOND = 396, /* SECOND */
SQL_MINUTE = 397, /* MINUTE */
SQL_HOUR = 398, /* HOUR */
SQL_DAY = 399, /* DAY */
SQL_MONTH = 400, /* MONTH */
SQL_YEAR = 401, /* YEAR */
SQL_SECONDS = 402, /* SECONDS */
SQL_MINUTES = 403, /* MINUTES */
SQL_HOURS = 404, /* HOURS */
SQL_DAYS = 405, /* DAYS */
SQL_MONTHS = 406, /* MONTHS */
SQL_YEARS = 407, /* YEARS */
SQL_INTERVAL = 408, /* INTERVAL */
SQL_TRUE = 409, /* TRUE */
SQL_FALSE = 410, /* FALSE */
SQL_BOOLEAN = 411, /* BOOLEAN */
SQL_TRANSACTION = 412, /* TRANSACTION */
SQL_BEGIN = 413, /* BEGIN */
SQL_COMMIT = 414, /* COMMIT */
SQL_ROLLBACK = 415, /* ROLLBACK */
SQL_NOWAIT = 416, /* NOWAIT */
SQL_SKIP = 417, /* SKIP */
SQL_LOCKED = 418, /* LOCKED */
SQL_SHARE = 419, /* SHARE */
SQL_RANGE = 420, /* RANGE */
SQL_ROWS = 421, /* ROWS */
SQL_GROUPS = 422, /* GROUPS */
SQL_UNBOUNDED = 423, /* UNBOUNDED */
SQL_FOLLOWING = 424, /* FOLLOWING */
SQL_PRECEDING = 425, /* PRECEDING */
SQL_CURRENT_ROW = 426, /* CURRENT_ROW */
SQL_EQUALS = 427, /* EQUALS */
SQL_NOTEQUALS = 428, /* NOTEQUALS */
SQL_LESS = 429, /* LESS */
SQL_GREATER = 430, /* GREATER */
SQL_LESSEQ = 431, /* LESSEQ */
SQL_GREATEREQ = 432, /* GREATEREQ */
SQL_NOTNULL = 433, /* NOTNULL */
SQL_UMINUS = 434 /* UMINUS */
};
typedef enum hsql_tokentype hsql_token_kind_t;
#endif
Expand Down Expand Up @@ -339,9 +340,11 @@ union HSQL_STYPE
hsql::RowLockMode lock_mode_t;
hsql::RowLockWaitPolicy lock_wait_policy_t;

hsql::ImportExportOptions* import_export_option_t;

// clang-format off

#line 345 "bison_parser.h"
#line 348 "bison_parser.h"

};
typedef union HSQL_STYPE HSQL_STYPE;
Expand Down
Loading

0 comments on commit 57c763a

Please sign in to comment.