aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/test/preproc
Commit message (Collapse)AuthorAge
* Update copyright for 2025Bruce Momjian2025-01-01
| | | | Backpatch-through: 13
* Update copyright for 2024Bruce Momjian2024-01-03
| | | | | | | | Reported-by: Michael Paquier Discussion: https://postgr.es/m/ZZKTDPxBBMt3C0J9@paquier.xyz Backpatch-through: 12
* Update copyright for 2023Bruce Momjian2023-01-02
| | | | Backpatch-through: 11
* Add copyright notices to meson filesAndrew Dunstan2022-12-20
| | | | Discussion: https://postgr.es/m/222b43a5-2fb3-2c1b-9cd0-375d376c8246@dunslane.net
* meson: Add initial version of meson based build systemAndres Freund2022-09-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Autoconf is showing its age, fewer and fewer contributors know how to wrangle it. Recursive make has a lot of hard to resolve dependency issues and slow incremental rebuilds. Our home-grown MSVC build system is hard to maintain for developers not using Windows and runs tests serially. While these and other issues could individually be addressed with incremental improvements, together they seem best addressed by moving to a more modern build system. After evaluating different build system choices, we chose to use meson, to a good degree based on the adoption by other open source projects. We decided that it's more realistic to commit a relatively early version of the new build system and mature it in tree. This commit adds an initial version of a meson based build system. It supports building postgres on at least AIX, FreeBSD, Linux, macOS, NetBSD, OpenBSD, Solaris and Windows (however only gcc is supported on aix, solaris). For Windows/MSVC postgres can now be built with ninja (faster, particularly for incremental builds) and msbuild (supporting the visual studio GUI, but building slower). Several aspects (e.g. Windows rc file generation, PGXS compatibility, LLVM bitcode generation, documentation adjustments) are done in subsequent commits requiring further review. Other aspects (e.g. not installing test-only extensions) are not yet addressed. When building on Windows with msbuild, builds are slower when using a visual studio version older than 2019, because those versions do not support MultiToolTask, required by meson for intra-target parallelism. The plan is to remove the MSVC specific build system in src/tools/msvc soon after reaching feature parity. However, we're not planning to remove the autoconf/make build system in the near future. Likely we're going to keep at least the parts required for PGXS to keep working around until all supported versions build with meson. Some initial help for postgres developers is at https://wiki.postgresql.org/wiki/Meson With contributions from Thomas Munro, John Naylor, Stone Tickle and others. Author: Andres Freund <andres@anarazel.de> Author: Nazir Bilal Yavuz <byavuz81@gmail.com> Author: Peter Eisentraut <peter@eisentraut.org> Reviewed-By: Peter Eisentraut <peter.eisentraut@enterprisedb.com> Discussion: https://postgr.es/m/20211012083721.hvixq4pnh2pixr3j@alap3.anarazel.de
* Fix possible omission of variable storage markers in ECPG.Tom Lane2022-09-09
| | | | | | | | | | | | | | | | | | | | | | | The ECPG preprocessor converted code such as static varchar str1[10], str2[20], str3[30]; into static struct varchar_1 { int len; char arr[ 10 ]; } str1 ; struct varchar_2 { int len; char arr[ 20 ]; } str2 ; struct varchar_3 { int len; char arr[ 30 ]; } str3 ; thus losing the storage attribute for the later variables. Repeat the declaration for each such variable. (Note that this occurred only for variables declared "varchar" or "bytea", which may help explain how it escaped detection for so long.) Andrey Sokolov Discussion: https://postgr.es/m/942241662288242@mail.yandex.ru
* Fix ECPG's handling of type names that match SQL keywords.Tom Lane2022-07-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, ECPG could only cope with variable declarations whose type names either weren't any SQL keyword, or were at least partially reserved. If you tried to use something in the unreserved_keyword category, you got a syntax error. This is pretty awful, not only because it says right on the tin that those words are not reserved, but because the set of such keywords tends to grow over time. Thus, an ECPG program that was just fine last year could fail when recompiled with a newer SQL grammar. We had to work around this recently when STRING became a keyword, but it's time for an actual fix instead of a band-aid. To fix, borrow a trick from C parsers and make the lexer's behavior change when it sees a word that is known as a typedef. This is not free of downsides: if you try to use such a name as a SQL keyword in EXEC SQL later in the program, it won't be recognized as a SQL keyword, leading to a syntax error there instead. So in a real sense this is just trading one hazard for another. But there is an important difference: with this, whether your ECPG program works depends only on what typedef names and SQL commands are used in the program text. If it compiles today it'll still compile next year, even if more words have become SQL keywords. Discussion: https://postgr.es/m/3661437.1653855582@sss.pgh.pa.us
* Remove duplicate includePeter Eisentraut2021-01-25
| | | | | Reported-by: Ashutosh Sharma <ashu.coek88@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/CAE9k0PkORqHHGKY54-sFyDpP90yAf%2B05Auc4fs9EAn4J%2BuBeUQ%40mail.gmail.com
* Avoid re-using output variables in new ecpg test case.Tom Lane2020-11-07
| | | | | | | | | The buildfarm thinks this leads to memory stomps, though annoyingly I can't duplicate that here. The existing code in strings.pgc is doing something that doesn't seem to be sanctioned at all really by the documentation, but I'm disinclined to try to make that nicer right now. Let's just declare some more output variables in hopes of working around it.
* Fix ecpg's mishandling of B'...' and X'...' literals.Tom Lane2020-11-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These were broken in multiple ways: * The xbstart and xhstart lexer actions neglected to set "state_before_str_start" before transitioning to the xb/xh states, thus possibly resulting in "internal error: unreachable state" later. * The test for valid string contents at the end of xb state was flat out wrong, as it accounted incorrectly for the "b" prefix that the xbstart action had injected. Meanwhile, the xh state had no such check at all. * The generated literal value failed to include any quote marks. * The grammar did the wrong thing anyway, typically ignoring the literal value and emitting something else, since BCONST and XCONST tokens were handled randomly differently from SCONST tokens. The first of these problems is evidently an oversight in commit 7f380c59f, but the others seem to be very ancient. The lack of complaints shows that ECPG users aren't using these syntaxes much (although I do vaguely remember one previous complaint). As written, this patch is dependent on 7f380c59f, so it can't go back further than v13. Given the shortage of complaints, I'm not excited about adapting the patch to prior branches. Report and patch by Shenhao Wang (test case adjusted by me) Discussion: https://postgr.es/m/d6402f1bacb74ecba22ef715dbba17fd@G08CNEXMBPEKD06.g08.fujitsu.local
* Avoid premature de-doubling of quote marks in ECPG strings.Tom Lane2020-10-22
| | | | | | | | | | | | | | | | | | | | | | If you write the literal 'abc''def' in an EXEC SQL command, that will come out the other end as 'abc'def', triggering a syntax error in the backend. Likewise, "abc""def" is reduced to "abc"def" which is wrong syntax for a quoted identifier. The cause is that the lexer thinks it should emit just one quote mark, whereas what it really should do is keep the string as-is. Add some docs and test cases, too. Although this seems clearly a bug, I fear users wouldn't appreciate changing it in minor releases. Some may well be working around it by applying an extra doubling of affected quotes, as for example sql/dyntest.pgc has been doing. Per investigation of a report from 1250kv, although this isn't exactly what he/she was on about. Discussion: https://postgr.es/m/673825.1603223178@sss.pgh.pa.us
* Fix behavior of ecpg's "EXEC SQL elif name".Tom Lane2020-08-03
| | | | | | | | | | | | | | | | | | This ought to work much like C's "#elif defined(name)"; but the code implemented it in a way equivalent to endif followed by ifdef, so that it didn't matter whether any previous branch of the IF construct had succeeded. Fix that; add some test cases covering elif and nested IFs; and improve the documentation, which also seemed a bit confused. AFAICS the code has been like this since the feature was added in 1999 (commit b57b0e044). So while it's surely wrong, there might be code out there relying on the current behavior. Hence, don't back-patch into stable branches. It seems all right to fix it in v13 though. Per report from Ashutosh Sharma. Reviewed by Ashutosh Sharma and Michael Meskes. Discussion: https://postgr.es/m/CAE9k0P=dQk9X0cU2tN49S7a9tv733-e1pVdpB1P-pWJ5PdTktg@mail.gmail.com
* Stop using spelling "nonexistant".Noah Misch2019-06-08
| | | | | The documentation used "nonexistent" exclusively, and the source tree used it three times as often as "nonexistant".
* Make some ecpg test cases more robust against unexpected errors that happenMichael Meskes2019-01-30
| | | | during development. Test cases themselves should not hang or segfault.
* Remove infinite-loop hazards in ecpg test suite.Tom Lane2019-01-24
| | | | | | | | | | | | | | | | | | | | | | | | A report from Andrew Dunstan showed that an ecpglib breakage that causes repeated query failures could lead to infinite loops in some ecpg test scripts, because they contain "while(1)" loops with no exit condition other than successful test completion. That might be all right for manual testing, but it seems entirely unacceptable for automated test environments such as our buildfarm. We don't want buildfarm owners to have to intervene manually when a test goes wrong. To fix, just change all those while(1) loops to exit after at most 100 iterations (which is more than any of them expect to iterate). This seems sufficient since we'd see discrepancies in the test output if any loop executed the wrong number of times. I tested this by dint of intentionally breaking ecpg_do_prologue to always fail, and verifying that the tests still got to completion. Back-patch to all supported branches, since the whole point of this exercise is to protect the buildfarm against future mistakes. Discussion: https://postgr.es/m/18693.1548302004@sss.pgh.pa.us
* printf("%lf") is not portable, so omit the "l".Tom Lane2018-05-20
| | | | | | | | | | | | The "l" (ell) width spec means something in the corresponding scanf usage, but not here. While modern POSIX says that applying "l" to "f" and other floating format specs is a no-op, SUSv2 says it's undefined. Buildfarm experience says that some old compilers emit warnings about it, and at least one old stdio implementation (mingw's "ANSI" option) actually produces wrong answers and/or crashes. Discussion: https://postgr.es/m/21670.1526769114@sss.pgh.pa.us Discussion: https://postgr.es/m/c085e1da-0d64-1c15-242d-c921f32e0d5c@dunslane.net
* Add some const decorations to prototypesPeter Eisentraut2017-11-10
| | | | Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>
* Remove unnecessary parentheses in return statementsPeter Eisentraut2017-09-05
| | | | | | | | The parenthesized style has only been used in a few modules. Change that to use the style that is predominant across the whole tree. Reviewed-by: Michael Paquier <michael.paquier@gmail.com> Reviewed-by: Ryan Murphy <ryanfmurphy@gmail.com>
* Fix locale dependency in new ecpg test case.Tom Lane2017-08-25
| | | | | | | | | Force sorting in "C" locale so that the output ordering doesn't vary, per buildfarm. In passing, add missing .gitignore entries. Discussion: https://postgr.es/m/0975f4bb-5dee-c33c-b719-3ce44026d397@chrullrich.net
* Implement DO CONTINUE action for ECPG WHENEVER statement.Michael Meskes2017-08-25
| | | | | Author: Vinayak Pokale Reviewed-By: Masahiko Sawada
* Revert "Ignore object files generated by ecpg test suite on Windows"Michael Meskes2015-03-09
| | | | This reverts commit b9e538b190d9cf4387361214eadc430393ebf852.
* Ignore object files generated by ecpg test suite on WindowsMichael Meskes2015-03-09
| | | | Patch by Michael Paquier
* Fix missing dependencies in ecpg's test Makefiles.Tom Lane2014-05-08
| | | | | | | | | | | | Ensure that ecpg preprocessor output files are rebuilt when re-testing after a change in the ecpg preprocessor itself, or a change in any of several include files that get copied verbatim into the output files. The lack of these dependencies was what created problems for Kevin Grittner after the recent pgindent run. There's no way for --enable-depend to discover these dependencies automatically, so we've gotta put them into the Makefiles by hand. While at it, reduce the amount of duplication in the ecpg invocations.
* ecpg: Add additional files to .gitignorePeter Eisentraut2014-04-23
| | | | These are test files added by f9179685371b74bf4752bf3f87846e5625cf91fa.
* Several fixes to array handling in ecpg.Michael Meskes2014-04-09
| | | | Patches by Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
* ECPG: Free the malloc()'ed variables in the test so it comes out clean onMichael Meskes2013-11-26
| | | | | | Valgrind runs. Patch by Boszormenyi Zoltan <zb@cybertec.at>
* Fix whitespace issues found by git diff --check, add gitattributesPeter Eisentraut2013-11-10
| | | | | Set per file type attributes in .gitattributes to fine-tune whitespace checks. With the associated cleanups, the tree is now clean for git
* Changed test case slightly so it doesn't have an unused typedef.Michael Meskes2013-11-03
|
* Do not use the variable name when defining a varchar structure in ecpg.Michael Meskes2012-02-13
| | | | With a unique counter being added anyway, there is no need anymore to have the variable name listed, too.
* Added test for cursor handling on different connections to regression testMichael Meskes2011-12-18
| | | | suite for ecpg.
* Remove useless whitespace at end of linesPeter Eisentraut2010-11-23
|
* Still more .gitignore cleanup.Tom Lane2010-09-24
| | | | | Fix overly-enthusiastic ignores, as identified by git ls-files -i --exclude-standard
* Add gitignore files for ecpg regression tests.Magnus Hagander2010-09-22
| | | | Backpatch to 8.2 as that's how far the structure looks the same.
* Remove extra newlines at end and beginning of files, add missing newlinesPeter Eisentraut2010-08-19
| | | | at end of files.
* pgindent run for 9.0, second runBruce Momjian2010-07-06
|
* Fixed ECPG regression test to make sure it uses absolute paths for includeMichael Meskes2010-03-22
| | | | files instead of relative ones which break vpath builds.
* ECPG only copied #include statements instead of processing them according toMichael Meskes2010-03-21
| | | | | commandline option "-i". This change fixes this and adds a test case. It also honors #include_next, although this is probably never used for embedded SQL.
* ecpg now adds a unique counter to its varchar struct definitions to make ↵Michael Meskes2010-03-09
| | | | these definitions unique, too. It used to use the linenumber but in the rare case of two definitions in one line this was not unique.
* Revert pgindent changes to ecpg include files that are part of ecpgBruce Momjian2010-02-26
| | | | | regession test output, and update pgindent script to avoid them in the future.
* pgindent run for 9.0Bruce Momjian2010-02-26
|
* Changed ECPG outofscope handling to always print out statements in the same ↵Michael Meskes2010-01-29
| | | | | | | | order so regression testing is possible, by Zoltan Boszormenyi
* Added test case that was part of Zoltan's patch but apparently wasn't part ↵Michael Meskes2010-01-26
| | | | of my commit.
* Applied patch by Boszormenyi Zoltan <zb@cybertec.at> to add out-of-scope ↵Michael Meskes2010-01-26
| | | | cursor support to native mode.
* Applied patch by Boszormenyi Zoltan <zb@cybertec.at> to fix problem in ↵Michael Meskes2010-01-22
| | | | auto-prepare mode if the connection is closed and re-opened and the previously prepared query is issued again.
* Fixed auto-prepare to not try preparing statements that are not preparable. BugMichael Meskes2009-12-16
| | | | | found and solved by Boszormenyi Zoltan <zb@cybertec.at>, some small adjustments by me.
* Added missing files.Michael Meskes2009-11-26
|
* Added dynamic cursor names to ecpg. Almost the whole patch was done byMichael Meskes2009-11-26
| | | | Boszormenyi Zoltan, with only a minor tweak or two from me.
* More variables gcc moans aboutMichael Meskes2009-05-20
|
* Fix ecpg tests for change that disallowed Unicode literals unlessTom Lane2009-05-06
| | | | standard_conforming_strings is on.
* Unicode escapes in strings and identifiersPeter Eisentraut2008-10-29
|