Commit Graph

3447 Commits

Author SHA1 Message Date
Peter Eisentraut 6f64c2e54a New unified regression test driver, test/regress makefile cleanup,
add "check" and "installcheck" targets, straighten out make variable naming
of host_os, host_cpu, etc.
2000-09-29 17:17:41 +00:00
Peter Eisentraut 2a7da3f564 Standardize on __CYGWIN__ rather than __CYGWIN32__ macro. Doesn't matter
either way (although the former is preferred by the Cygwin folks
themselves), but using only one seems nicer.
2000-09-29 13:53:35 +00:00
Peter Eisentraut 52dda5ec05 Cygwin uses _sys_nerr for sys_nerr 2000-09-29 13:35:26 +00:00
Hiroshi Inoue 5f18e2183e BufferAlloc() doesn't allocate write error buffers.
Remove compiler waring(my fault).
2000-09-29 03:55:45 +00:00
Hiroshi Inoue 77df055c54 avoid database-wide restart on write error 2000-09-29 01:23:47 +00:00
Peter Eisentraut 664ce79dd8 Fixes for Cygwin, with help from Pete Forman <gsez020@kryten.bedford.waii.com>.
Update the installation instructions (formerly misnamed "FAQ"), add configure
checks for some headers rather than having users copy stubs manually (ugh!).
Use Autoconf check for exe extension.  This also avoids inheriting the value
of $(X) from the environment.
2000-09-27 15:17:57 +00:00
Peter Eisentraut 64610a82f2 Reset current user id to session user id during transaction abort 2000-09-27 10:41:55 +00:00
Peter Eisentraut c0cba9efe7 When the RI triggers lock the PK table, temporarily switch the current user
id to the owner of the PK table, to avoid permission problems.
2000-09-25 22:34:20 +00:00
Tom Lane e353e73768 Correct error in grammar for subselect-in-FROM: SQL spec does not allow
omission of alias_clause for a subselect.
2000-09-25 18:38:39 +00:00
Tom Lane 8bdc2bf030 Use variable aliases, if supplied, rather than real column names in
complaints about ungrouped variables.  This is for consistency with
behavior elsewhere, notably the fact that the relname is reported as
an alias in these same complaints.  Also, it'll work with subselect-
in-FROM where old code didn't.
2000-09-25 18:14:55 +00:00
Tom Lane 164caa3951 System neglected to complain about ungrouped variables passed to
sublinks when outer query contained aggregates but no GROUP clause.
2000-09-25 18:09:28 +00:00
Bruce Momjian ebdfac3bb1 the patch include:
- rename ichar() to chr() (discussed with Tom)

        - add docs for oracle compatible routines:

                btrim()
                ascii()
                chr()
                repeat()

        - fix bug with timezone in to_char()

        - all to_char() variants return NULL instead textin("")
          if it's needful.

 The contrib/odbc is without changes and contains same routines as main
tree ... because I not sure how plans are Thomas with this :-)

                                        Karel
---------------------------------------------------------------------------

This effectively one line patch should fix the fact that
foreign key definitions in create table were erroring if
a primary key was defined.  I was using the columns
list to get the columns of the table for comparison, but
it got reused as a temporary list inside the primary key
stuff.

Stephan Szabo
2000-09-25 12:58:47 +00:00
Tom Lane a8405cfc4d Acquire read lock on a buffer while writing it out, to prevent
concurrent modifications to the page by other backends.
2000-09-25 04:11:09 +00:00
Tom Lane acbbeffc29 Clean up some ugly coding (hardwired constants) in index_formtuple. 2000-09-23 22:40:12 +00:00
Tom Lane 920c5062d2 SetPGVariable() crashed on SET DateStyle TO DEFAULT and related cases. 2000-09-22 15:34:31 +00:00
Tom Lane eab8ee9524 Fix coredump in copyCommentStmt(). 2000-09-20 15:28:01 +00:00
Tom Lane 95563e7bbf Make sure that FlushRelationBuffers() is invoked by all paths through
vacuum.c.  This is needed to make the world safe for pg_upgrade.
2000-09-19 19:30:03 +00:00
Tom Lane ba2ea6e0f5 Fix GEQO optimizer to work correctly with new outer-join-capable
query representation.  Note that GEQO_RELS setting is now interpreted
as the number of top-level items in the FROM list, not necessarily the
number of relations in the query.  This seems appropriate since we are
only doing join-path searching over the top-level items.
2000-09-19 18:42:34 +00:00
Peter Eisentraut 457ac0331c Implement differentiation between CURRENT_USER and SESSION_USER as per SQL.
There is still no effective difference but it will kick in once setuid
functions exist (not included here).  Make old getpgusername() alias for
current_user.
2000-09-19 18:18:04 +00:00
Tom Lane a5a290cab9 Make rule lister use aliases from FROM clause when a table column has
been given an alias.  Otherwise, results are incorrect.
2000-09-18 20:14:23 +00:00
Tom Lane aef7a0c8ea Parse JOIN/ON conditions with the proper visibility of input columns,
ie, consider only the columns coming from the JOIN clause's sub-clauses.
Also detect attempts to reference columns belonging to other tables
(which would still be possible using an explicitly-qualified name).
I'm not sure this implements the spec's semantics 100% accurately, but
at least it gives plausible behavior.
2000-09-17 22:21:27 +00:00
Peter Eisentraut 335248c9b7 Support for DESTDIR make variable. This is used as in `make install
DESTDIR=/else/where' and prepends the value of DESTDIR to the full
installation paths (e.g., /else/where/usr/local/pgsql/bin). This allows
users to install the package into a location different from the one that
was configured and hard-coded into various scripts, e.g., for creating
binary packages.

DESTDIR is in many cases preferrable over `make install
prefix=/else/where' because

a) `prefix' affects the path that is hard-coded into the files, which can
lead to a `make install prefix=xxx' (as done by the regression test
driver) corrupting the files in the source tree with wrong paths.

b) it doesn't work at all if a directory was overridden to not depend on
`prefix', e.g., --sysconfdir=/etc.

(Updating the regression test driver to use DESTDIR is a separate
undertaking.)

See also autoconf@gnu.org, From: Akim Demaille <akim@epita.fr>, Date: 08
Sep 2000 12:48:59 +0200, Message-ID:
<mv4em2vb1lw.fsf@nostromo.lrde.epita.fr>, Subject: Re: HTML format
documentation.
2000-09-17 13:02:52 +00:00
Tom Lane 8ae9ad1cb8 Reimplement LIKE/ESCAPE as operators so that indexscan optimization
can still work, per recent discussion on pghackers.  Correct some bugs
in ILIKE implementation.
2000-09-15 18:45:31 +00:00
Tom Lane ed5003c584 First cut at full support for OUTER JOINs. There are still a few loose
ends to clean up (see my message of same date to pghackers), but mostly
it works.  INITDB REQUIRED!
2000-09-12 21:07:18 +00:00
Tom Lane 39ee0f55d7 Fix relation-to-view conversion so that it doesn't try to convert a plain
relation to a view when you create an ON INSERT/UPDATE/DELETE rule ...
2000-09-12 20:38:09 +00:00
Tom Lane d49a73bbc2 Suppress compile warnings caused by failure to use PG_RETURN macro. 2000-09-12 19:39:42 +00:00
Tom Lane cdc7170ebe Remove incorrect extra heap_close when deleting a builtin function. 2000-09-12 16:48:55 +00:00
Thomas G. Lockhart 4d745dadc9 Modify date->timestamp conversion to use mktime().
This should do better than before around Daylight Savings Time
 transitions.
2000-09-12 05:41:37 +00:00
Bruce Momjian 7f171b599a This patch implements the following command:
ALTER TABLE <tablename> OWNER TO <username>

Only a superuser may execute the command.

--
Mark Hollomon
mhh@mindspring.com
2000-09-12 05:09:57 +00:00
Bruce Momjian 264c068207 This patch implements a different "relkind"
for views. Views are now have a "relkind" of
RELKIND_VIEW instead of RELKIND_RELATION.

Also, views no longer have actual heap storage
files.

The following changes were made

1. CREATE VIEW sets the new relkind

2. The executor complains if a DELETE or
        INSERT references a view.

3. DROP RULE complains if an attempt is made
        to delete a view SELECT rule.

4. CREATE RULE "_RETmytable" AS ON SELECT TO mytable DO INSTEAD ...
        1. checks to make sure mytable is empty.
        2. sets the relkind to RELKIND_VIEW.
        3. deletes the heap storage files.
5. LOCK myview is not allowed. :)


6. the regression test type_sanity was changed to
        account for the new relkind value.

7. CREATE INDEX ON myview ... is not allowed.

8. VACUUM myview is not allowed.
        VACUUM automatically skips views when do the entire
        database.

9. TRUNCATE myview is not allowed.


THINGS LEFT TO THINK ABOUT

o pg_views

o pg_dump

o pgsql (\d \dv)
o Do we really want to be able to inherit from views?

o Is 'DROP TABLE myview' OK?

--
Mark Hollomon
2000-09-12 04:49:17 +00:00
Bruce Momjian 1da2feea83 Previous patch backed out.
Here is a patch against CVS (without my earlier patch)
to disallow

LOCK x

if x is a view.

It does not use the SPI interface.

--
Mark Hollomon
2000-09-12 04:33:18 +00:00
Bruce Momjian 7361e91ab7 This patch is for the TODO item
* Disallow LOCK on view

src/backend/commands/command.c is the only affected file

--
Mark Hollomon
2000-09-12 04:30:08 +00:00
Bruce Momjian 0ba0e32172 O.K. -
Here's the multibyte aware version of my patch to fix the truncation
of the rulename autogenerated during a CREATE VIEW. I've modified all
the places in the backend that want to construct the rulename to use
the MakeRetrieveViewRuleName(), where I put the #ifdef MULTIBYTE, so
that's the only place that knows how to construct a view rulename. Except
pg_dump, where I replicated the code, since it's a standalone binary.

The only effect the enduser will see is that views with names len(name)
> NAMEDATALEN-4 will fail to be created, if the derived rulename clases
with an existing rule: i.e. the user is trying to create two views with
long names whose first difference is past NAMEDATALEN-4 (but before
NAMEDATALEN: that'll error out after the viewname truncation.) In no
case will the user get left with a table without a view rule, as the
current code does.

Ross Reedstrom
2000-09-12 04:15:58 +00:00
Vadim B. Mikheev f2bfe8a24c Heap redo/undo (except for tuple moving used by vacuum). 2000-09-07 09:58:38 +00:00
Peter Eisentraut ffd9aaa0a9 A bit of cleanup after SSL patch. Add it to config file, improve
documentation.
2000-09-06 19:54:52 +00:00
Peter Eisentraut 6dc249610a Code cleanup of user name and user id handling in the backend. The current
user is now defined in terms of the user id, the user name is only computed
upon request (for display purposes). This is kind of the opposite of the
previous state, which would maintain the user name and compute the user id
for permission checks.

Besides perhaps saving a few cycles (integer vs string), this now creates a
single point of attack for changing the user id during a connection, for
purposes of "setuid" functions, etc.
2000-09-06 14:15:31 +00:00
Jan Wieck daf1e3a702 Added functions
quote_ident(text) returns text
    quote_literal(text) returns text

These are handy to build up properly quoted query strings
for the new PL/pgSQL EXECUTE functionality to submit
dynamic DDL statements.

Jan
2000-09-05 20:25:14 +00:00
Peter Eisentraut 424f0edcb8 Fix relative path references so that make knowns which dependencies refer
to one another. Sort out builddir vs srcdir variable namings. Remove some
now obsoleted make variables.
2000-08-31 16:12:35 +00:00
Tom Lane 16dc9bafb7 AbortOutOfAnyTransaction() just before backend exit, to ensure that
resources are cleaned up if the user disconnected mid-transaction.
Great thanks to Hiroshi for pointing out what should have been obvious...
2000-08-30 20:30:06 +00:00
Bruce Momjian 7bc654bb16 SSL patch from Magnus 2000-08-30 14:54:24 +00:00
Hiroshi Inoue 3498ea8308 Improve the following.
=# create table t (id int4 unique);
NOTICE:  CREATE TABLE/UNIQUE will create implicit index 't_id_key' for table 't'
 =# begin;
 query: drop table t;
NOTICE:  Caution: DROP TABLE cannot be rolled back, so don't abort now
NOTICE:  Caution: DROP INDEX cannot be rolled back, so don't abort now
 =# rollback;
 =# drop table t;
NOTICE:  mdopen: couldn't open t: No such file or directory
NOTICE:  RelationIdBuildRelation: smgropen(t): No such file or directory
NOTICE:  mdopen: couldn't open t: No such file or directory
NOTICE:  mdopen: couldn't open t: No such file or directory
NOTICE:  mdopen: couldn't open t_id_key: No such file or directory
NOTICE:  RelationIdBuildRelation: smgropen(t_id_key): No such file or directory
NOTICE:  mdopen: couldn't open t: No such file or directory
NOTICE:  RelationIdBuildRelation: smgropen(t): No such file or directory
NOTICE:  mdopen: couldn't open t: No such file or directory
ERROR:  cannot open relation t
2000-08-30 08:48:55 +00:00
Tom Lane 883d1cc1cc Include kernel error message in failed-to-open file reports. 2000-08-29 16:40:19 +00:00
Peter Eisentraut ef6164de1d Revert removal of signed, volatile, and signal handler arg type tests. 2000-08-29 09:36:51 +00:00
Bruce Momjian dffd8cac3d * to_char:
- full support for IW (ISO week) and vice versa conversion for IW too
    (the to_char 'week' support is now complete and I hope correct).

  Thomas, I use for IW code from timestamp.c, for this I create separate
  function date2isoweek() from original 'case DTK_WEEK:' code in the
  timestamp_part(). I mean will better use one code for same feature in
  date_part() and in to_char(). The isoweek2date() is added to timestamp.c
  too. Right?

  IMHO in 7.1 will all to_char's features complete. It is cca 41 templates
  for date/time and cca 21 for numbers.

 * to_ascii:

   - gcc, is it correct now? :-)


  In the patch is documentation for to_char's IW and for to_ascii().

                                                        Karel
2000-08-29 04:41:48 +00:00
Bruce Momjian d4f626507c This is mostly the same as an earlier patch I
didn't hear anything about, but which would
have broken with the function manager changes
anyway.

Well, this patch checks that a unique constraint
of some form (unique or pk) is on the referenced
columns of an FK constraint and that the columns
in the referencing table exist at creation time.
The former is to move closer to SQL compatibility
and the latter is in answer to a bug report.
I also added a basic check of this functionality
to the alter table and foreign key regression
tests.

Stephan Szabo
sszabo@bigpanda.com
2000-08-29 04:20:47 +00:00
Peter Eisentraut 3ce5c6f4d8 Maybe "shared_buffers" is a slightly better name than "shmem_buffers" for -B. 2000-08-28 11:57:41 +00:00
Peter Eisentraut f03fc94e7d New configure test for flex, which recognizes only flex but does so in all
incarnations (I hope). When an acceptable flex version is not found, print
instructive error messages from both configure and the makefiles, so that
users can continue building anyway.
2000-08-28 11:53:23 +00:00
Tom Lane 4c8d2f7f7b Clean up callers of AllocateFile and BasicOpenFile to ensure that
a reasonable error message (including the kernel errno message)
is reported on any file open failure.
2000-08-27 21:50:18 +00:00
Tom Lane 5ba9d8c2d4 Change ReleaseLruFile() usage so that if we cannot release any more
virtual FDs, we just return the ENFILE/EMFILE error to the caller,
rather than immediate elog().  This allows more robust behavior in
the postmaster, which uses AllocateFile() but does not want elog().
2000-08-27 21:48:00 +00:00
Peter Eisentraut 79abd73eee Remove configure tests for `signed', `volatile', and signal handler args;
the harm potential outweighs the possible benefits.
2000-08-27 19:00:41 +00:00