Commit Graph

49 Commits

Author SHA1 Message Date
Tom Lane 6f0cef9353 Fix assorted bugs in ecpg's macro mechanism.
The code associated with EXEC SQL DEFINE was unreadable and full of
bugs, notably:

* It'd attempt to free a non-malloced string if the ecpg program
tries to redefine a macro that was defined on the command line.

* Possible memory stomp if user writes "-D=foo".

* Undef'ing or redefining a macro defined on the command line would
change the state visible to the next file, when multiple files are
specified on the command line.  (While possibly that could have been
an intentional choice, the code clearly intends to revert to the
original macro state; it's just failing to consider this interaction.)

* Missing "break" in defining a new macro meant that redefinition
of an existing name would cause an extra entry to be added to the
definition list.  While not immediately harmful, a subsequent undef
would result in the prior entry becoming visible again.

* The interactions with input buffering are subtle and were entirely
undocumented.

It's not that surprising that we hadn't noticed these bugs,
because there was no test coverage at all of either the -D
command line switch or multiple input files.  This patch adds
such coverage (in a rather hacky way I guess).

In addition to the code bugs, the user documentation was confused
about whether the -D switch defines a C macro or an ecpg one, and
it failed to mention that you can write "-Dsymbol=value".

These problems are old, so back-patch to all supported branches.

Discussion: https://postgr.es/m/998011.1713217712@sss.pgh.pa.us
2024-04-16 12:31:42 -04:00
Tom Lane 980a70b976 Fix our getopt_long's behavior for a command line argument of just "-".
src/port/getopt_long.c failed on such an argument, always seeing it
as an unrecognized switch.  This is unhelpful; better is to treat such
an item as a non-switch argument.  That behavior is what we find in
GNU's getopt_long(); it's what src/port/getopt.c does; and it is
required by POSIX for getopt(), which getopt_long() ought to be
generally a superset of.  Moreover, it's expected by ecpg, which
intends an argument of "-" to mean "read from stdin".  So fix it.

Also add some documentation about ecpg's behavior in this area, since
that was miserably underdocumented.  I had to reverse-engineer it
from the code.

Per bug #16304 from James Gray.  Back-patch to all supported branches,
since this has been broken forever.

Discussion: https://postgr.es/m/16304-c662b00a1322db7f@postgresql.org
2020-03-23 11:58:00 -04:00
Peter Eisentraut 3b9b7516f4 ecpg: Document new compatibility option
It's listed in --help, so it should be listed in the man page as well.
2018-06-07 23:33:24 -04:00
Peter Eisentraut 3c49c6facb Convert documentation to DocBook XML
Since some preparation work had already been done, the only source
changes left were changing empty-element tags like <xref linkend="foo">
to <xref linkend="foo"/>, and changing the DOCTYPE.

The source files are still named *.sgml, but they are actually XML files
now.  Renaming could be considered later.

In the build system, the intermediate step to convert from SGML to XML
is removed.  Everything is build straight from the source files again.
The OpenSP (or the old SP) package is no longer needed.

The documentation toolchain instructions are updated and are much
simpler now.

Peter Eisentraut, Alexander Lakhin, Jürgen Purtz
2017-11-23 09:44:28 -05:00
Peter Eisentraut 1ff01b3902 Convert SGML IDs to lower case
IDs in SGML are case insensitive, and we have accumulated a mix of upper
and lower case IDs, including different variants of the same ID.  In
XML, these will be case sensitive, so we need to fix up those
differences.  Going to all lower case seems most straightforward, and
the current build process already makes all anchors and lower case
anyway during the SGML->XML conversion, so this doesn't create any
difference in the output right now.  A future XML-only build process
would, however, maintain any mixed case ID spellings in the output, so
that is another reason to clean this up beforehand.

Author: Alexander Lakhin <exclusion@gmail.com>
2017-10-20 19:26:10 -04:00
Peter Eisentraut c29c578908 Don't use SGML empty tags
For DocBook XML compatibility, don't use SGML empty tags (</>) anymore,
replace by the full tag name.  Add a warning option to catch future
occurrences.

Alexander Lakhin, Jürgen Purtz
2017-10-17 15:10:33 -04:00
Michael Meskes 4032ef18d0 Fix buffer overflow on particularly named files and clarify documentation about
output file naming.

Patch by Tsunakawa, Takayuki <tsunakawa.takay@jp.fujitsu.com>
2016-12-22 08:28:13 +01:00
Peter Eisentraut bb4eefe7bf doc: Improve DocBook XML validity
DocBook XML is superficially compatible with DocBook SGML but has a
slightly stricter DTD that we have been violating in a few cases.
Although XSLT doesn't care whether the document is valid, the style
sheets don't necessarily process invalid documents correctly, so we need
to work toward fixing this.

This first commit moves the indexterms in refentry elements to an
allowed position.  It has no impact on the output.
2014-02-23 21:31:08 -05:00
Peter Eisentraut bb7520cc26 Make documentation of --help and --version options more consistent
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-18 02:46:59 +03:00
Peter Eisentraut 6ef2448796 Fix a whitespace issue with the man pages
There is what may actually be a mistake in our markup.  The problem is
in a situation like

<para>
 <command>FOO</command> is ...

there is strictly speaking a line break before "FOO".  In the HTML
output, this does not appear to be a problem, but in the man page
output, this shows up, so you get double blank lines at odd places.

So far, we have attempted to work around this with an XSL hack, but
that causes other problems, such as creating run-ins in places like

<acronym>SQL</acronym> <command>COPY</command>

So fix the problem properly by removing the extra whitespace.  I only
fixed the problems that affect the man page output, not all the
places.
2011-08-07 10:55:32 +03:00
Peter Eisentraut c13dc6402b Spell checking and markup refinement 2011-05-19 01:14:45 +03:00
Alvaro Herrera 01dd34d55a Fix broken markup, and remove tabs 2011-03-25 12:21:12 -03:00
Michael Meskes 71ac48fd9c Documented some ecpg command line options that were missing:
-r no_indicator
-r prepare
-r questionsmarks
2011-03-25 02:30:50 +01:00
Peter Eisentraut fc946c39ae Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
Magnus Hagander 9f2e211386 Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
Bruce Momjian f8f0140d73 Document --version and --help options for all client applications (they
all support it).

Per report from Josh Kupershmidt
2010-02-19 14:36:45 +00:00
Bruce Momjian 2f6b4560af First pass over client applications documentation proofreading.
gabrielle
2010-02-19 03:50:03 +00:00
Bruce Momjian e81c138e18 Update reference documentation on may/can/might:
Standard English uses "may", "can", and "might" in different ways:

        may - permission, "You may borrow my rake."

        can - ability, "I can lift that log."

        might - possibility, "It might rain today."

Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice.  Similarly, "It may crash" is better stated, "It might crash".
2007-01-31 23:26:05 +00:00
Bruce Momjian 32cebaecff Remove emacs info from footer of SGML files. 2006-09-16 00:30:20 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Peter Eisentraut 1af403e42d Complete options help and put it in less random order. 2003-11-02 12:55:24 +00:00
Tom Lane f3ad615ce8 Fix a batch of speling misteaks identified by Peter's spell-checker tool. 2003-09-20 20:12:05 +00:00
Peter Eisentraut c326d8f4f2 Add/edit index entries. 2003-08-31 17:32:24 +00:00
Peter Eisentraut 5e5c5cd31a Merge documentation into one book. (Build with "make html".) Replace
vague cross-references with real links.
2003-03-25 16:15:44 +00:00
Peter Eisentraut d258ba01ec Another big editing pass for consistent content and presentation. 2003-03-24 14:32:51 +00:00
Bruce Momjian be2b660ecd This patch includes a lot of minor cleanups to the SGML documentation,
including:

- replacing all the appropriate usages of <citetitle>PostgreSQL
...</citetitle> with &cite-user;, &cite-admin;, and so on

- fix an omission in the EXECUTE documentation

- add some more text to the EXPLAIN documentation

- improve the PL/PgSQL RETURN NEXT documentation (more work to do here)

- minor markup fixes


Neil Conway
2003-01-19 00:13:31 +00:00
Bruce Momjian da8149032a SGML improvements.
Neil Conway
2002-11-15 03:11:18 +00:00
Peter Eisentraut 266a280584 Add introductory sections explaining what each book is about. Remove Y2K
statement.
2002-10-24 17:48:54 +00:00
Peter Eisentraut cc4f576957 Improve ECPG documentation. 2002-10-21 18:04:05 +00:00
Peter Eisentraut 06ad580f75 Structure reference pages consistently. Document that structure.
Add information about environment variables.
2002-07-28 15:22:21 +00:00
Thomas G. Lockhart c05f29e895 Augment the date/time examples in the User's Guide to reflect the newer
capabilities of specifying time zones as intervals per SQL9x.
Put refentrytitle contents on the same line as the tag.
 Otherwise, leading whitespace is propagated into the product, which
 (at least) messes up the ToC layout.
Remove (some) docinfo tags containing dates. Best to omit if the dates
 are not accurate; maybe use CVS dates instead or leave them out.
2002-04-21 19:02:39 +00:00
Peter Eisentraut bf43bed848 Spell-check and markup police 2002-01-20 22:19:57 +00:00
Bruce Momjian 9600ccad13 Improve description of autocommit behavior in ecpg manual pages. 2002-01-18 20:32:54 +00:00
Bruce Momjian 96ad60e919 Fix ecpg wording to be consistent. 2002-01-06 18:12:00 +00:00
Bruce Momjian 99a3396822 ecpg.sgml manual page updated to ON.
---------------------------------------------------------------------------

When you run 'ecpg --help' you get the following:

          -t   turn on autocommit of transactions

amongst the other options... Shouldn't this be OFF as per the
documentation?

Best regards, Lee.

--
 Lee Kindness,   Senior Software Engineer,   lkindness@csl.co.uk
2002-01-04 18:58:46 +00:00
Thomas G. Lockhart 03a321d214 Use PostgreSQL consistantly throughout docs. Before, usage was split evenly
between Postgres and PostgreSQL.
2001-12-08 03:24:40 +00:00
Peter Eisentraut 651a639b8b proof-reading 2001-11-28 20:49:10 +00:00
Peter Eisentraut 17f0b55d15 Initial round of tweakage for man pages 2001-11-18 20:35:02 +00:00
Tatsuo Ishii b4982f9b6d Fix typo. 2001-09-14 10:24:35 +00:00
Peter Eisentraut 89a1ea4207 Put some kind of grammatical uniformity in the <refpurpose> lines. 2001-09-03 12:57:50 +00:00
Peter Eisentraut 7e20c35e1c Add ecpg --help and --version. Renumber the exit status codes, which were
documented wrong.
2001-08-24 22:37:36 +00:00
Bruce Momjian 62f5badebf Remove mention that PREPARE is not implemented. 2001-07-11 03:43:52 +00:00
Peter Eisentraut 6ea087b243 Add missing TO. 2001-03-19 16:20:52 +00:00
Peter Eisentraut dccfd74935 Refine some things to create better looking man pages. 2000-12-25 23:15:27 +00:00
Bruce Momjian b32685a999 Add proofreader's changes to docs.
Fix misspelling of disbursion to dispersion.
2000-10-05 19:48:34 +00:00
Bruce Momjian b5c0ab278b typo fix 2000-09-12 20:58:14 +00:00
Thomas G. Lockhart 2b6a35f7cd Fix several <ulink> tags which refer to e-mail addresses
but were missing the "mailto:" prefix.
Fix typo.
Thanks to Neil Conway <nconway@klamath.dyndns.org> for the heads-up.
2000-08-23 05:59:11 +00:00
Thomas G. Lockhart f43974f6f1 Include all information from the old man pages. 2000-03-31 06:17:52 +00:00
Thomas G. Lockhart a27512e634 Complete merge of all old man page information.
ecpg reference page still needs formatting.
1999-07-22 15:09:15 +00:00