code review by Tom Lane. Remaining issues: functions that take or
return tuple types are likely to break if one drops (or adds!)
a column in the table defining the type. Need to think about what
to do here.
Along the way: some code review for recent COPY changes; mark system
columns attnotnull = true where appropriate, per discussion a month ago.
attstattarget to indicate 'use the default'. The default is now a GUC
variable default_statistics_target, and so may be changed on the fly. Along
the way we gain the ability to have pg_dump dump the per-column statistics
target when it's not the default. Patch by Neil Conway, with some kibitzing
from Tom Lane.
All of the internal tags are of the latter.
The other thing I noticed is that most of the quick examples in the file
use a para and synopsis. Is there a reason we're not using <example/> ?
Rod Taylor
The attached patch completes the following TODO item:
* Generate failure on short COPY lines rather than pad NULLs
I also restructed a lot of the existing COPY code, did some code
review on the column list patch sent in by Brent Verner a little
while ago, and added some regression tests. I also added an
explicit check (and resultant error) for extra data before
the end-of-line.
Neil Conway
changes mentioned above, and also adds a new function to the tablefunc
API. The tablefunc API change adds the following function:
* Oid foidGetTypeId(Oid foid) - Get a function's typeid given the
* function Oid. Use this together with TypeGetTupleDesc() to get a
* TupleDesc which is derived from the function's declared return type.
In the next post I'll send the contrib/tablefunc patch, which
illustrates the usage of this new function. Also attached is a doc patch
for this change. The doc patch also adds a function that I failed to
document previously.
Joe Conway
documentation (xindex.sgml should be rewritten), need to teach pg_dump
about it, need to update contrib modules that currently build pg_opclass
entries by hand. Original patch by Bill Studenmund, grammar adjustments
and general update for 7.3 by Tom Lane.
pg_language.lancompiler
pg_operator.oprprec
pg_operator.oprisleft
pg_proc.proimplicit
pg_proc.probyte_pct
pg_proc.properbyte_cpu
pg_proc.propercall_cpu
pg_proc.prooutin_ratio
pg_shadow.usetrace
pg_type.typprtlen
pg_type.typreceive
pg_type.typsend
Attempts to use the obsoleted attributes of pg_operator or pg_proc
in the CREATE commands will be greeted by a warning. For pg_type,
there is no warning (yet) because pg_dump scripts still contain these
attributes.
Also remove new but already obsolete spellings
isVolatile, isStable, isImmutable in WITH clause. (Use new syntax
instead.)
> * -Add GUC parameter for DATESTYLE
> o -Allow specification of column names
> o -Change syntax to WITH DELIMITER, (keep old syntax around?)
> o -Remove SET KSQO option now that OR processing is improved (Tom)
> o -Allow SHOW to output as a query result, like EXPLAIN
> * -Add SQL92 schemas (Tom)
extension to create binary compatible casts. Includes dependency tracking
as well.
pg_proc.proimplicit is now defunct, but will be removed in a separate
commit.
pg_dump provides a migration path from the previous scheme to declare
casts. Dumping binary compatible casts is currently impossible, though.
reflects the changes in the tablefunc-fix patch that I sent in the other
day. It also refers to "see contrib/tablefunc for more examples", which
is next on my list of things to finish and submit.
Joe Conway
COPY x (a,d,c,b) from stdin;
COPY x (a,c) to stdout;
as well as the corresponding changes to pg_dump to use the new
functionality. This functionality is not available when using
the BINARY option. If a column is not specified in the COPY FROM
statement, its default values will be used.
In addition to this functionality, I tweaked a couple of the
error messages emitted by the new COPY <options> checks.
Brent Verner
> > David Clark (dclarknospam@opsi.co.za) reports a bug with a severity
> > Table 3-7 SQL Literal escaped octets shows the input escape
> > representation for a single quote as '\\'' , but the third paragraph
> > below table 3-8 SQL Output Escaped Octets says that the single quote
> > must be input as '\''
>
> Nice catch. '\'' is correct as shown in the example in Table 3-7.
>
> >
> > Also in the same paragraph mentioned above it says input for the
> > single quote must be '\'' (or '\\134') shouldn't this be (or '\\047')
>
> Also a bug. Should be '\\047', as you pointed out.
>
Here's a patch to fix the binary string doc errors.
Joe Conway
UNIQUE and DISTINCT predicates are both listed as implemented -- AFAIK,
neither is.
I also included another trivial patch which adds the default location
of the DSSSL stylesheets on my system (Debian unstable, docbook-dsssl
1.76) to the list of paths that configure looks for.
Neil Conway
> o -Add ALTER TABLE DROP non-CHECK CONSTRAINT
> * -Allow psql \d to show foreign keys
> * -Auto-destroy sequence on DROP of table with SERIAL; perhaps a separate
> * -Prevent column dropping if column is used by foreign key
> * -Automatically drop constraints/functions when object is dropped
> * -Make foreign key constraints clearer in dump file
> * -Make foreign keys easier to identify
pg_relcheck is gone; CHECK, UNIQUE, PRIMARY KEY, and FOREIGN KEY
constraints all have real live entries in pg_constraint. pg_depend
exists, and RESTRICT/CASCADE options work on most kinds of DROP;
however, pg_depend is not yet very well populated with dependencies.
(Most of the ones that are present at this point just replace formerly
hardwired associations, such as the implicit drop of a relation's pg_type
entry when the relation is dropped.) Need to add more logic to create
dependency entries, improve pg_dump to dump constraints in place of
indexes and triggers, and add some regression tests.
Fix pg_dump to not quote the function name in the storage tag.
Fix pg_dump so GRANT/REVOKE(ACL) tag entries are not quoted, for
consistency.
Fix pg_restore to properly handle quotes and some spaces in -P.
Also implement alternative forms to expose the PostgreSQL CREATE FUNCTION
features.
Implement syntax for READ ONLY and READ WRITE clauses in SET TRANSACTION.
READ WRITE is already implemented (of course).
Implement syntax for "LIKE table" clause in CREATE TABLE. Should be fairly
easy to complete since it resembles SELECT INTO.
Implement MATCH SIMPLE clause for foreign key definitions. This is explicit
SQL99 syntax for the default behavior, so we now support it :)
Start implementation of shorthand for national character literals in
scanner. For now, just swallow the leading "N", but sometime soon let's
figure out how to pass leading type info from the scanner to the parser.
We should use the same technique for binary and hex bit string literals,
though it might be unusual to have two apparently independent literal
types fold into the same storage type.
> information and SQL language specific info wrt SRFs. I've taken to
> calling this feature "Table Fuctions" to be consistent with (at least)
> one well known RDBMS.
Joe Conway
Second cut attached. This one just adds a boolean option to the existing
function to indicate that implicit schemas are to be included (or not).
I remembered the docs as well this time :-)
Dave Page
but occasionally I may need to shut down the server and restart it
w/o tcpip sockets. Postmaster has the -i option to turn on tcpip
connections, but it wasn't immediately clear how to easily or
temporarily turn it off (when it's been enabled in postgresql.conf).
In fact, it wasn't clear to me until digging in to postmaster.c that
I could pass '-c tcpip_socket=false' or '--tcpip_socket=false'.
(And then of course when I looked more closely at the man page I
realized I'd missed the proper part of the documentation.) What I'd
been looking for is a flag that would have the opposite effect of
'-i', and it's conceivable that others will be looking for specific
flags to do the opposite of '-F' and '-S'.
I was preparing to add options to postmaster until I realized that
maybe the solution is just to add some documentation.
If you'd rather have 1 character options to accomplish this, I'd be
happy to do that-- adding those 9 lines of code is definitely within
my ability. :) (Although, the "right" letter to be the opposite of -S
isn't clear to me, since -s is already taken.)
Ron Snyder.
>
> > Is it a good idea to provide an example (such as the above), or should I
> > just try and describe the behaviour?
>
> Examples are generally good things ...
OK, the attached documentation patch provides some simple examples of
use of tablename as a parameter, %ROWTYPE and %TYPE.
In the end I decided that the documentation is literally correct, but
hard to follow without any examples explicitly showing the use of a
table name as a parameter.
Andrew McMillan
Remove ODBC-compatible empty parentheses from calls to SQL99 functions
for which these parentheses do not match the standard.
Update the ODBC driver to ensure compatibility with the ODBC standard
for these functions (e.g. CURRENT_TIMESTAMP, CURRENT_USER, etc).
Include a new appendix in the User's Guide which lists the labeled features
for SQL99 (the labeled features replaced the "basic", "intermediate",
and "advanced" categories from SQL92). features.sgml does not yet split
this list into "supported" and "unsupported" lists.
Implement SQL99 SIMILAR TO as a synonym for our existing operator "~".
Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape).
Extend the definition to make the FOR clause optional.
Define textregexsubstr() to actually implement this feature.
Update the regression test to include these new string features.
All tests pass.
Rename the regular expression support routines from "pg95_xxx" to "pg_xxx".
Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
Implement SQL99 SIMILAR TO as a synonym for our existing operator "~".
Implement SQL99 regular expression SUBSTRING(string FROM pat FOR escape).
Extend the definition to make the FOR clause optional.
Define textregexsubstr() to actually implement this feature.
Update the regression test to include these new string features.
All tests pass.
Rename the regular expression support routines from "pg95_xxx" to "pg_xxx".
Define CREATE CHARACTER SET in the parser per SQL99. No implementation yet.
function body (and other properties) as a function in the language
is created. This generalizes ad hoc code that already existed for
the built-in languages.
The validation now happens after the pg_proc tuple of the new function
is created, so it is possible to define recursive SQL functions.
Add some regression test cases that cover bogus function definition
attempts.
GUC support. It's now possible to set datestyle, timezone, and
client_encoding from postgresql.conf and per-database or per-user
settings. Also, implement rollback of SET commands that occur in a
transaction that later fails. Create a SET LOCAL var = value syntax
that sets the variable only for the duration of the current transaction.
All per previous discussions in pghackers.
underlying function; but cause psql's \do to show the underlying
function's comment if the operator has no comment of its own, to preserve
the useful functionality of the original behavior. Also, implement
COMMENT ON SCHEMA. Patch from Rod Taylor.
to reset session userid to the originally-authenticated name. Also,
relax SET SESSION AUTHORIZATION to allow specifying one's own username
even if one is not superuser, so as to avoid unnecessary error messages
when loading a pg_dump file that uses this command. Per discussion from
several months ago.
per pghackers discussion. Add some more typsanity tests, and clean
up some problems exposed thereby (broken or missing array types for
some built-in types). Also, clean up loose ends from unknownin/out
patch.
The attached patch allows views to have default values. You can't
specify a default value within a CREATE VIEW statement, it must be
done using ALTER TABLE ... ALTER COLUMN ... SET DEFAULT after the
view has already been created. Most of the hard work was done by
Tom Lane, I just patched pg_dump and updated the documentation.
Neil Conway <neilconway@rogers.com>
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.
different privilege bits (might as well make use of the space we were
wasting on padding). EXECUTE and USAGE bits for procedures, languages
now are separate privileges instead of being overlaid on SELECT. Add
privileges for namespaces and databases. The GRANT and REVOKE commands
work for these object types, but we don't actually enforce the privileges
yet...
(tgrelid, tgname). This provides an additional check on trigger name
uniqueness per-table (which was already enforced by the code anyway).
With this change, RelationBuildTriggers will read the triggers in
order by tgname, since it's scanning using this index. Since a
predictable trigger ordering has been requested for some time, document
this behavior as a feature. Also document that rules fire in name
order, since yesterday's changes to pg_rewrite indexing cause that too.
DROP RULE and COMMENT ON RULE syntax adds an 'ON tablename' clause,
similar to TRIGGER syntaxes. To allow loading of existing pg_dump
files containing COMMENT ON RULE, the COMMENT code will still accept
the old syntax --- but only if the target rulename is unique across
the whole database.