summaryrefslogtreecommitdiff
path: root/src/parser/outfuncs.c
AgeCommit message (Collapse)Author
13 daysRun pgindent.Tatsuo Ishii
Also update typedefs.list and README.pgpool.
2025-10-03Feature: Import PostgreSQL 18 new parser.Bo Peng
Major changes of PostgreSQL 18 parser include: - Allow generated columns to be virtual - Add OLD/NEW support to RETURNING in DML queries - Addition of various constraints (e.g. WITHOUT OVERLAPS, ENFORCED / NOT ENFORCED) - etc.
2025-07-17Run pgindent.Tatsuo Ishii
2024-10-21Feature: Import PostgreSQL 17 RC1 new parser.Bo Peng
Major changes of PostgreSQL 17 parser include: - Allow MERGE to use NOT MATCHED BY SOURCE and RETURNING clause: MERGE INTO ... WHEN NOT MATCHED BY SOURCE ... MERGE INTO ... RETURNING ... - Add new COPY option ON_ERROR ignore and LOG_VERBOSITY: COPY ... WITH (ON_ERROR ignore); COPY ... WITH (LOG_VERBOSITY verbose); - Allow to use '*' to specify the COPY FROM options FORCE_NOT_NULL and FORCE_NULL for all columns. COPY ... WITH (FORCE_NOT_NULL *); COPY ... WITH (FORCE_NULL *); - Add EXPLAIN option SERIALIZE and MEMORY EXPLAIN (MEMORY) ... EXPLAIN (ANALYZE, SERIALIZE ...) ... - Allow ALTER TABLE to use SET STATISTICS DEFAULT to set a column to the default statistics target ALTER TABLE ... ALTER COLUMN ... SET STATISTICS DEFAULT; - Allow ALTER TABLE to change a column's generation expression ALTER TABLE ... ALTER COLUMN ... SET EXPRESSION; - Add DEFAULT setting for ALTER TABLE .. SET ACCESS METHOD ALTER TABLE ... SET STATISTICS DEFAULT; - Allow event triggers to use login event: CREATE EVENT TRIGGER ... ON login ... - Add event trigger support for REINDEX.
2024-05-20Delete unnecessary if branch.Bo Peng
https://github.com/pgpool/pgpool2/issues/52
2023-07-31Feature: Import PostgreSQL 16 BETA1 new parser.Chen Ningwei
Major changes of PostgreSQL 16 parser include: - Add new option DEFAULT to COPY FROM COPY ... FROM stdin WITH (default 'xx'); - Allow the STORAGE type to be specified by CREATE TABLE CREATE TABLE t1 ( c1 VARCHAR(10) STORAGE PLAIN, c2 TEXT STORAGE EXTENDED ); - Add EXPLAIN option GENERIC_PLAN to display the generic plan for a parameterized query EXPLAIN (GENERIC_PLAN) SELECT ...; - Allow subqueries in the FROM clause to omit aliases SELECT COUNT(*) FROM (SELECT ... FROM ...); - Add SQL/JSON constructors - Add VACUUM options SKIP_DATABASE_STATS, ONLY_DATABASE_STATS to skip or update all frozen statistics PROCESS_MAIN to only process TOAST tables VACUUM (SKIP_DATABASE_STATS); VACUUM (PROCESS_MAIN FALSE) t1 ;
2023-06-23Fix missing CTE SEARCH and CYCLE rewrites.Bo Peng
In native replication mode, Pgpool-II need to rewrite Date/Time functions to timestamp in WRITE queries. CTE SEARCH and CYCLE rewrites were missing.
2022-12-20Fix time stamp rewrite bug.Tatsuo Ishii
In native replication/snapshot isolation mode, any write query including timestamp/date/time data are rewritten so that all PostgreSQL servers accept same timestamp etc. value. From 4.4 outfuncs module which is used to generate rewritten query was broken for boolean data. In a parse tree constant data is represented as "A_Const". 4.4 updated the module by using PostgreSQL 15's outfuncs module. Starting from PostgreSQL 15 A_Const handles more data type including boolean. Unfortunately the pgpool's outfuncs module did not adopt the change. As a result boolean constant was ignored and turned into empty string in the rewritten query string, which caused syntax errors. This commit fixes the issue. Also modify _outA_Const() so that it uses _out* functions to handle other data types to save a few lines of code. Per report from Michiel van Leening. Discussion: at: https://www.pgpool.net/pipermail/pgpool-general/2022-December/008581.html Back-patch to: 4.4.
2022-09-26Fix to to use NIL to judge a List is empty or not.Tatsuo Ishii
Previously it mistakenly judge by the value of the pointer itself is NULL, which is not allowed by our coding standard.
2022-09-21Feature: Import PostgreSQL 15 BETA4 new parser.Bo Peng
Major changes of PostgreSQL 15 parser include: - Add new SQL MERGE command MERGE INTO ... USING ... - Add new option HEADER MATCH to COPY FROM COPY ... FROM stdin WITH (HEADER MATCH); - Allow foreign key ON DELETE SET actions CREATE TABLE t1 ( ... FOREIGN KEY (c1, c2) REFERENCES t2 ON DELETE SET NULL (c2) ); - Allow SET ACCESS METHOD in ALTER TABLE ALTER TABLE ... SET ACCESS METHOD ...;
2022-08-26Retire pool_string module.Tatsuo Ishii
Currently there are two string manipulation modules: pool_string and StringInfo. StringInfo is more feature rich and PostgreSQL compatible because it was imported from PostgreSQL. So replace all usages of pool_string by StringInfo. This also solves a problem reported by Peng: i.e. struct name "String" collision: pool_string uses "String" and PostgreSQL 15's parser also uses "String".
2021-09-27Feature: Import PostgreSQL 14 beta2 new parser.Bo Peng
Major changes of PostgreSQL 14 parser include: - Allow an alias to be used to a JOIN ... USING SELECT ... FROM t1 JOIN t2 USING (a, b, c) AS x - Allow DISTINCT to be added to GROUP BY SELECT c1, max(c2) FROM t1 GROUP BY DISTINCT c1; - New SEARCH and CYCLE clauses for common table expressions
2020-12-26Apply mega typo fixes.Tatsuo Ishii
Fixes for source code files including *.[chl] and regression scripts, not only for comments but variable names and function names. Documents (sgml and some text files) are also fixed. See: https://github.com/pgpool/pgpool2/pull/38 for more details. Patch contributed by Josh Soref. Fixes for Japanese sgml files by me.
2020-11-17Fix query rewrite syntax error of "INSERT ... ON CONFLICT" in native ↵Bo Peng
replication mode. per bug 654.
2020-09-07Feature: Import PostgreSQL 13 beta3 new parser.Bo Peng
Major changes of PostgreSQL 13 parser include: - Remove an object's dependency on an extension ALTER TRIGGER ... NO DEPENDS ON EXTENSION ... ALTER FUNCTION ... NO DEPENDS ON EXTENSION ... - Allow FETCH FIRST to use WITH TIES FETCH FIRST ... WITH TIES - Add ALTER TABLE clause DROP EXPRESSION ALTER TABLE ... DROP EXPRESSION - Allow setting statistics target for extended statistics ALTER STATISTICS ... SET STATISTICS - Allow ALTER VIEW to rename view columns ALTER VIEW ... RENAME COLUMN ... TO ... - Add CREATE DATABASE clause LOCALE option CREATE DATABASE ... LOCALE - Add DROP DATABASE clause WITH FORCE option DROP DATABASE ... WITH (force) - Add VACUUM clause PARALLEL option VACUUM (PARALLEL 1) ...
2019-09-17Fix compiler warnings.Tatsuo Ishii
2019-09-12Fix identical code used for different branches per Coverity.Tatsuo Ishii
2019-09-05Fix outfuncs.c to support PostgreSQL 12 CTE [NOT] MATERIALIZED.Bo Peng
2019-08-14Fix memory leak.Tatsuo Ishii
Pointed out by Coverity.
2019-07-24Feature: Import PostgreSQL 12 beta2 new parser.Bo Peng
The attached patch imports PostgreSQL12 beta2 parser to Pgpool-II 4.1. Major chanegs of PostgreSQL 12 parser include: - Add new VACUUM options: -- SKIP_LOCKED -- INDEX_CLEANUP -- TRUNCATE - Add COMMIT AND CHAIN and ROLLBACK AND CHAIN commands - Add a WHERE clause to COPY FROM - Allow to use CREATE OR REPLACE AGGREGATE command - Allow to use mcv (most-common-value) in CREATE STATISTICS - ADD REINDEX option CONCURRENTLY - Add EXPLAIN option SETTINGS - etc.
2019-07-10Fix Pgpool-II rewriting query error when the queries include "GROUPS" and ↵Bo Peng
"EXCLUDE" in frame clauses. This occurs only in native replication mode. Thanks to Yugo Nagata for the bug reporting.
2019-06-07Fix to deal with backslashes according to the config of ↵Bo Peng
standard_conforming_strings in native replication mode. per bug467.
2019-05-22Fix memory leak in outfuncs.c pointed out by Coverity.Tatsuo Ishii
2018-10-18Fix syntax error in native replication, when queries including now() etc. ↵Bo Peng
and "IN (SELECT ...)" in WHERE clause. In native replication, queries including now() etc. are rewritten to a timestamp constant value. However, Pgpool-II didn't support queries including now() etc. and "IN (SELECT ...)" in WHERE clause. Per bug433.
2018-08-28Import PostgreSQL 11 beta3 parser.Bo Peng
2018-08-17Run pgindent.Tatsuo Ishii
Fix and unify indentation by using PostgreSQL 11's pgindent command.
2017-10-03Import PostgreSQL 10 parser.pengbo
2017-09-24Revert "Import PostgreSQL 10.0 SQL parser."pengbo
This reverts commit d9b35160a66b1e9c4c32cd0363e2099c93c968b6.
2017-09-22Import PostgreSQL 10.0 SQL parser.pengbo
2016-09-07add PostgreSQL 9.6 parserpengbo
2015-10-15Fix stupid mistakes of flag checkYugo Nagata
2015-10-15Fix segfalut that occurs when function is used in FROM clauseYugo Nagata
When a function is used in FROM, the parser makes a RangeFunction node whose functions member is a list whose last element is NIL. This caused segfault in foreach loop in _outListWith(). PRPARE statements in streaming-reaplication mode and INSERT/UPDATE with SELECT in native-replication mode were affected. For example: - prepare p as select * from generate_series(1,1); - insert into tbl select now(), * from generate_series(1,1);
2015-10-13Import parser of PostgreSQL 9.5Yugo Nagata
In addition, timestamp-rewrite supports - INSERT ... ON CONFLICT - INSERT/UPDATE/DELETE with WITH clause - GROUPING SETS, CUBE, ROLLUP, TABLESAMPLE in SELECT statement in WITH clause - INSERT/UPDATE/DELETE in WITH clause - RETURNING clause - UPDATE xxx SET (y,z) = (SELECT u,w from zzz) Othres: - Table alias in INSTER query - WITH clause including INSERT/UPDATE - SELECT ... TABLESAMPLE is not allowed to be query-cached
2014-09-15Final checkin of series for fixing "[pgpool-hackers: 592]. pool_error and elog",Muhammad Usama
This commit removes all occurrences of pool_error() and replace those with ereport(). The checking also integrates the exception manager to watchdog code, which was the last remaining TODO of importing the exception and memory managers to pgpool-II
2014-08-05Back porting coverity issues fix patch from master branch.Muhammad Usama
Fix coverity issue:1111377 Unchecked return value Fix coverity issue:1111381 Logically dead code Fix coverity issue:1222992 Unchecked return value Fix coverity issue:1222993 Unchecked return value Fix coverity issue:1222996 Printf arg type mismatch Fix coverity issue:1222997 Printf arg type mismatch For the coverity issue 1222996 and 1222997 the return type of NameListToString function is changed from string* to char*, and defination of the which is the return type of the function in PostgreSQL source. and appropriate changes have been made in the code to incorporate this function return type change. For coverity issue:1222992 1222993 the return type of do_query() function is changed to void from POOL_STATUS. The function’s return value became insignificant after the introduction of elog API, After the API do_query() only returns in a successful scenarios and throws an ereport in case of any error within the function.
2014-07-17Fix coverity issue:1111380 Logically dead codeMuhammad Usama
Fix coverity issue:1111382 Logically dead code Fix coverity issue:1111402 Explicit null dereferenced Fix coverity issue:1111405 Explicit null dereferenced Fix coverity issue:1111407 Dereference after null check Fix coverity issue:1111408 Explicit null dereferenced Fix coverity issue:1111409 Dereference after null check Fix coverity issue:1111383 Logically dead code Fix coverity issue:1111492 Structurally dead code Fix coverity issue:1111417 Nesting level does not match indentation Fix coverity issue:1111379 Logically dead code Fix coverity issue:1111406 Explicit null dereferenced Fix coverity issue:1111396 Explicit null dereferenced Fix coverity issue:1111397 Explicit null dereferenced
2014-07-15Fix coverity issue:1111387 Explicit null dereferencedMuhammad Usama
Fix coverity issue:1111388 Explicit null dereferenced Fix coverity issue:1111411 Missing break in switch Fix coverity issue:1111412 Missing break in switch Fix coverity issue:1111450 Resource leak Fix coverity issue:1111451 Resource leak Fix coverity issue:1111472 Dereference before null check Fix coverity issue:1111473 Dereference before null check Fix coverity issue:1111474 Dereference before null check Fix coverity issue:1111475 Wrong sizeof argument Fix coverity issue:1111495 Use after free Fix coverity issue:1111496 Use after free Fix coverity issue:1222989 Bad bit shift operation Fix coverity issue:1222990 Bad bit shift operation Fix coverity issue:1222994 Explicit null dereferenced Fix coverity issue:1222995 Printf format string issue The commit also contains a tiny fix for compiler warning of missing prototype for ExceptionalCondition() function.
2014-07-07commit imports PostgreSQL 9.4 raw parser.Muhammad Usama
2014-04-29Fixing the compiler warningsMuhammad Usama
2014-04-28This is the first of the series of commits to import PostgreSQL's exception ↵Muhammad Usama
and memory manager in pgpool. This checkin includes the following items. 1-- Exception manager API of Postgres is added to pgpool, The API consists of elog.c and elog.h files. Since this API is very extensive and is designed for PostgreSQL, So to fit it properly into pgpool I have modified it a little bit, and most of the modifications are related to removal of code which is not required for pgpool. 2-- Added on_proc_exit callback mechanism of Postgres. To facilitate the cleanup at exit time. 3-- Added PostgreSQL's memory manager (palloc API). This includes the client side palloc functions placed in 'src/tools' directory (fe_memutils) 4-- Removed the existing memory manager which was very minimalistic and was not integrated in all parts of the code. 5-- The checkin also refectors some portions of code to make the code more readable at first glance. That includes -- Dividing the main.c file into two files main.c and pgpool_main.c, Now the main.c file only contains the code related to early initialisations of pgpool and parsing of the command line options. The actual logic of the pgpool main process is moved to new pgpool_main.c file. -- Breaking up some large functions in child.c into smaller functions. -- Rewrite the pgpool's main loop logic to make the code more readable. Remaining TODOs on this front. 1-- The current checkin only integrates the memory and exception manager in main process and connection creation segment of pgpool child process. And the next TODO is to integrate it in pcp and worker child process. 2-- Integration of newly added API into query processor logic in child processes. 3-- elog.c and elog.h files needs some cleanups and changes (To remove unwanted functions and data members of ErrorData structure).
2013-08-14Apply code reorganization maga patch from Muhammad Usama.Tatsuo Ishii
Adjust for recent changes in the repository by Tatsuo Ishii.