summaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc
AgeCommit message (Collapse)Author
2014-07-21Translation updatesPeter Eisentraut
2014-07-20Replace "internationalize" with "localize" where appropriatePeter Eisentraut
2014-06-10Stamp shared-library minor version numbers for 9.5.Tom Lane
2014-05-28Revert "Fix bogus %name-prefix option syntax in all our Bison files."Tom Lane
This reverts commit 45b7abe59e9485657ac9380f35d2d917dd0da25b. It turns out that the %name-prefix syntax without "=" does not work at all in pre-2.4 Bison. We are not prepared to make such a large jump in minimum required Bison version just to suppress a warning message in a version hardly any developers are using yet. When 3.0 gets more popular, we'll figure out a way to deal with this. In the meantime, BISONFLAGS=-Wno-deprecated is recommendable for anyone using 3.0 who doesn't want to see the warning.
2014-05-28Fix bogus %name-prefix option syntax in all our Bison files.Tom Lane
%name-prefix doesn't use an "=" sign according to the Bison docs, but it silently accepted one anyway, until Bison 3.0. This was originally a typo of mine in commit 012abebab1bc72043f3f670bf32e91ae4ee04bd2, and we seem to have slavishly copied the error into all the other grammar files. Per report from Vik Fearing; analysis by Peter Eisentraut. Back-patch to all active branches, since somebody might try to build a back branch with up-to-date tools.
2014-05-21Fix spurious tab characterPeter Eisentraut
2014-05-06pgindent run for 9.4Bruce Momjian
This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
2014-05-06Fix handling of array of char pointers in ecpglib.Michael Meskes
When array of char * was used as target for a FETCH statement returning more than one row, it tried to store all the result in the first element. Instead it should dump array of char pointers with right offset, use the address instead of the value of the C variable while reading the array and treat such variable as char **, instead of char * for pointer arithmetic. Patch by Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
2014-04-14Fix whitespacePeter Eisentraut
2014-04-09Several fixes to array handling in ecpg.Michael Meskes
Patches by Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
2014-03-03Fix whitespacePeter Eisentraut
2014-03-01Various Coverity-spotted fixesStephen Frost
A number of issues were identified by the Coverity scanner and are addressed in this patch. None of these appear to be security issues and many are mostly cosmetic changes. Short comments for each of the changes follows. Correct the semi-colon placement in be-secure.c regarding SSL retries. Remove a useless comparison-to-NULL in proc.c (value is dereferenced prior to this check and therefore can't be NULL). Add checking of chmod() return values to initdb. Fix a couple minor memory leaks in initdb. Fix memory leak in pg_ctl- involves free'ing the config file contents. Use an int to capture fgetc() return instead of an enum in pg_dump. Fix minor memory leaks in pg_dump. (note minor change to convertOperatorReference()'s API) Check fclose()/remove() return codes in psql. Check fstat(), find_my_exec() return codes in psql. Various ECPG memory leak fixes. Check find_my_exec() return in ECPG. Explicitly ignore pqFlush return in libpq error-path. Change PQfnumber() to avoid doing an strdup() when no changes required. Remove a few useless check-against-NULL's (value deref'd beforehand). Check rmtree(), malloc() results in pg_regress. Also check get_alternative_expectfile() return in pg_regress.
2014-02-17Prevent potential overruns of fixed-size buffers.Tom Lane
Coverity identified a number of places in which it couldn't prove that a string being copied into a fixed-size buffer would fit. We believe that most, perhaps all of these are in fact safe, or are copying data that is coming from a trusted source so that any overrun is not really a security issue. Nonetheless it seems prudent to forestall any risk by using strlcpy() and similar functions. Fixes by Peter Eisentraut and Jozef Mlich based on Coverity reports. In addition, fix a potential null-pointer-dereference crash in contrib/chkpass. The crypt(3) function is defined to return NULL on failure, but chkpass.c didn't check for that before using the result. The main practical case in which this could be an issue is if libc is configured to refuse to execute unapproved hashing algorithms (e.g., "FIPS mode"). This ideally should've been a separate commit, but since it touches code adjacent to one of the buffer overrun changes, I included it in this commit to avoid last-minute merge issues. This issue was reported by Honza Horak. Security: CVE-2014-0065 for buffer overruns, CVE-2014-0066 for crypt()
2014-02-12Rename 'gmake' to 'make' in docs and recommended commandsBruce Momjian
This simplifies the docs and makes it easier to cut/paste command lines.
2014-02-08Mark some more variables as static or include the appropriate headerPeter Eisentraut
Detected by clang's -Wmissing-variable-declarations. From: Andres Freund <andres@anarazel.de>
2014-01-09Fix descriptor output in ECPG.Michael Meskes
While working on most platforms the old way sometimes created alignment problems. This should fix it. Also the regresion tests were updated to test for the reported case. Report and fix by MauMau <maumau307@gmail.com>
2014-01-07Update copyright for 2014Bruce Momjian
Update all files in head, and files COPYRIGHT and legal.sgml in all back branches.
2013-12-02Translation updatesPeter Eisentraut
2013-11-27ECPG: Fix searching for quoted cursor names case-sensitively.Michael Meskes
Patch by Böszörményi Zoltán <zb@cybertec.at>
2013-11-26ECPG: Make the preprocessor emit ';' if the variable type for a list ofMichael Meskes
variables is varchar. This fixes this test case: int main(void) { exec sql begin declare section; varchar a[50], b[50]; exec sql end declare section; return 0; } Since varchars are internally turned into custom structs and the type name is emitted for these variable declarations, the preprocessed code previously had: struct varchar_1 { ... } a _,_ struct varchar_2 { ... } b ; The comma in the generated C file was a syntax error. There are no regression test changes since it's not exercised. Patch by Boszormenyi Zoltan <zb@cybertec.at>
2013-11-25More improvement to comment parsing in ecpg.Michael Meskes
ECPG is not supposed to allow and output nested comments in C. These comments are only allowed in the SQL parts and must not be written into the C file. Also the different handling of different comments is documented.
2013-11-25Fix ecpg parsing of sizeof().Michael Meskes
The last fix used the wrong non-terminal to define valid types.
2013-11-24Allow C array definitions to use sizeof().Michael Meskes
When parsing C variable definitions ecpg should allow sizeof() operators as array dimensions.
2013-11-24Distinguish between C and SQL mode for C-style comments.Michael Meskes
SQL standard asks for allowing nested comments, while C does not. Therefore the two comments, while mostly similar, have to be parsed seperately.
2013-11-19ecpg: Split off mmfatal() from mmerror()Peter Eisentraut
This allows decorating mmfatal() with noreturn compiler hints, leading to better diagnostics.
2013-11-10Fix whitespace issues found by git diff --check, add gitattributesPeter Eisentraut
Set per file type attributes in .gitattributes to fine-tune whitespace checks. With the associated cleanups, the tree is now clean for git
2013-10-07Translation updatesPeter Eisentraut
2013-09-08Close file to no leak file descriptor memory. Found by Coverity.Michael Meskes
2013-09-02Translation updatesPeter Eisentraut
2013-08-18Translation updatesPeter Eisentraut
2013-07-29Sync ECPG with WITH ORDINALITY changesGreg Stark
2013-07-06Also escape double quotes for ECPG's #line statement.Michael Meskes
2013-07-05Apploed patch by MauMau <maumau307@gmail.com> to escape filenames in #line ↵Michael Meskes
statements.
2013-06-29ecpg: Consistently use mm_strdup()Peter Eisentraut
mm_strdup() is provided to check errors from strdup(), but some places were failing to use it.
2013-06-14Stamp shared-library minor version numbers for 9.4.Tom Lane
2013-05-29pgindent run for release 9.3Bruce Momjian
This is the first run of the Perl-based pgindent script. Also update pgindent instructions.
2013-05-05Translation updatesPeter Eisentraut
2013-04-20Clean up references to SQL92Peter Eisentraut
In most cases, these were just references to the SQL standard in general. In a few cases, a contrast was made between SQL92 and later standards -- those have been kept unchanged.
2013-02-27Add support for piping COPY to/from an external program.Heikki Linnakangas
This includes backend "COPY TO/FROM PROGRAM '...'" syntax, and corresponding psql \copy syntax. Like with reading/writing files, the backend version is superuser-only, and in the psql version, the program is run in the client. In the passing, the psql \copy STDIN/STDOUT syntax is subtly changed: if you the stdin/stdout is quoted, it's now interpreted as a filename. For example, "\copy foo from 'stdin'" now reads from a file called 'stdin', not from standard input. Before this, there was no way to specify a filename called stdin, stdout, pstdin or pstdout. This creates a new function in pgport, wait_result_to_str(), which can be used to convert the exit status of a process, as returned by wait(3), to a human-readable string. Etsuro Fujita, reviewed by Amit Kapila.
2013-02-26Remove the check for COPY TO STDIN and COPY FROM STDOUT from ecpg.Heikki Linnakangas
The backend grammar treats STDIN and STDOUT completely interchangeable, so that the above accepted. Arguably that was a mistake the backend grammar, but it's not ecpg's business to second guess that.
2013-01-01Update copyrights for 2013Bruce Momjian
Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
2012-11-29When processing nested structure pointer variables ecpg always expected anMichael Meskes
array datatype which of course is wrong. Applied patch by Muhammad Usama <m.usama@gmail.com> to fix this.
2012-11-28Suppress parallel build in interfaces/ecpg/preproc/.Tom Lane
This is to see if it will stop intermittent build failures on buildfarm member okapi. We know that gmake 3.82 has some problems with sometimes not honoring dependencies in parallel builds, and it seems likely that this is more of the same. Since the vast bulk of the work in the preproc directory is associated with creating preproc.c and then preproc.o, parallelism buys us hardly anything here anyway. Also, make both this .NOTPARALLEL and the one previously added in interfaces/ecpg/Makefile be conditional on "ifeq ($(MAKE_VERSION),3.82)". The known bug in gmake is fixed upstream and should not be present in 3.83 and up, and there's no reason to think it affects older releases.
2012-11-23Applied patch by Chen Huajun <chenhj@cn.fujitsu.com> to make ecpg able to copeMichael Meskes
with very long structs.
2012-10-12In our source code, make a copy of getopt's 'optarg' string arguments,Bruce Momjian
rather than just storing a pointer.
2012-10-11Refactor flex and bison make rulesPeter Eisentraut
Numerous flex and bison make rules have appeared in the source tree over time, and they are all virtually identical, so we can replace them by pattern rules with some variables for customization. Users of pgxs will also be able to benefit from this.
2012-08-07Implement SQL-standard LATERAL subqueries.Tom Lane
This patch implements the standard syntax of LATERAL attached to a sub-SELECT in FROM, and also allows LATERAL attached to a function in FROM, since set-returning function calls are expected to be one of the principal use-cases. The main change here is a rewrite of the mechanism for keeping track of which relations are visible for column references while the FROM clause is being scanned. The parser "namespace" lists are no longer lists of bare RTEs, but are lists of ParseNamespaceItem structs, which carry an RTE pointer as well as some visibility-controlling flags. Aside from supporting LATERAL correctly, this lets us get rid of the ancient hacks that required rechecking subqueries and JOIN/ON and function-in-FROM expressions for invalid references after they were initially parsed. Invalid column references are now always correctly detected on sight. In passing, remove assorted parser error checks that are now dead code by virtue of our having gotten rid of add_missing_from, as well as some comments that are obsolete for the same reason. (It was mainly add_missing_from that caused so much fudging here in the first place.) The planner support for this feature is very minimal, and will be improved in future patches. It works well enough for testing purposes, though. catversion bump forced due to new field in RangeTblEntry.
2012-07-04Run newly-configured perltidy script on Perl files.Bruce Momjian
Run on HEAD and 9.2.
2012-06-18Make documentation of --help and --version options more consistentPeter Eisentraut
Before, some places didn't document the short options (-? and -V), some documented both, some documented nothing, and they were listed in various orders. Now this is hopefully more consistent and complete.
2012-06-13Stamp library minor versions for 9.3.Tom Lane
This includes fixing the MSVC copy of ecpg/preproc's version info, which seems to have been overlooked repeatedly. Can't we fix that so there are not two copies??