Commit Graph

15017 Commits

Author SHA1 Message Date
Bruce Momjian be1c6e7529 Here's some changes I made last night to psql's common.c (as found in
7.3.2).  It removes some code duplication and #ifdeffing, and some
unstructured ugliness such as tacky breaks and an unneeded continue.
Breaks up a large function into smaller functions and reduces required
nesting levels, and kills a variable or two.

Jeroen T. Vermeulen
2003-03-20 06:00:12 +00:00
Bruce Momjian 94701fb24b Peter found bug in the to_char() routine for PL/MI options. This
patch fix it -- but this patch doesn't contains tests or docs fixes. I
 will send it later.

 Fixed outputs:

select  to_char(x, '9999.999')  as x,
        to_char(x, 'S9999.999') as s,
        to_char(x, 'SG9999.999') as sg,
        to_char(x, 'MI9999.999') as mi,
        to_char(x, 'PL9999.999') as pl,
        to_char(x, 'PLMI9999.999') as plmi,
        to_char(x, '9999.999SG') as sg2,
        to_char(x, '9999.999PL') as pl2,
        to_char(x, '9999.999MI') as mi2 from num;

Karel Zak
2003-03-20 05:19:26 +00:00
Bruce Momjian 8000fdd462 > > - Move SEQ_MAXVALUE, SEQ_MINVALUE definitions to sequence.h
> >
> > - Add check in pg_dump to see if the value returned is the max /min
> > values and replace with NO MAXVALUE, NO MINVALUE.
> >
> > - Change START and INCREMENT to use START WITH and INCREMENT BY syntax.
> > This makes it a touch easier to port to other databases with sequences
> > (Oracle).  PostgreSQL supports both syntaxes already.
>
> +       char            bufm[100],
> +                               bufx[100];
>
> This seems to be an arbitary size. Why not set it to the actual maximum
> length?
>
> Also:
>
> +       snprintf(bufm, 100, INT64_FORMAT, SEQ_MINVALUE);
> +       snprintf(bufx, 100, INT64_FORMAT, SEQ_MAXVALUE);
>
> sizeof(bufm), sizeof(bufx) is probably the more
> maintenance-friendly/standard way to do it.

I changed the code to use sizeof - but will wait for a response from
Peter before changing the size.  It's consistent throughout the sequence
code to be 100 for this purpose.

Rod Taylor <rbt@rbt.ca>
2003-03-20 05:18:15 +00:00
Bruce Momjian a00431b8d8 "Information_schema" changes
- Add domain check constraints to "check_constraints" view
- Create "domains" view
- Create "domain_constraints" view

--
Rod Taylor <rbt@rbt.ca>
2003-03-20 05:06:55 +00:00
Bruce Momjian 54ca7a7b13 (Now featuring documentation: fixed some typos, expanded the
Envrironment and Files section, explained exactly what -w
does)

This is a patch which allows pg_ctl to make an intelligent
guess as to the proper port when running 'psql -l' to
determine if the database has started up (the -w flag).

The environment variable PGPORT is used. If that is not found,
it checks if a specific port has been set inside the postgresql.conf
file. If it is has not, it uses the port that Postgres was
compiled with.

Greg Sabino Mullane  greg@turnstep.com
2003-03-20 05:00:14 +00:00
Bruce Momjian 3c28f9c144 This trivial cleans up a little bit of the code in
src/test/regress/regress.c (e.g. removing K & R style parameter
declarations, improving sprintf() usage, etc.)

Neil Conway
2003-03-20 04:52:35 +00:00
Bruce Momjian 15ce2d2e4a > I can see a couple possible downsides: (a) the library might have some
> weird behavior across fork boundaries; (b) the additional memory space
> that has to be duplicated into child processes will cost something per
> child launch, even if the child never uses it.  But these are only
> arguments that it might not *always* be a prudent thing to do, not that
> we shouldn't give the DBA the tool to do it if he wants.  So fire away.

Here is a patch for the above, including a documentation update. It
creates a new GUC variable "preload_libraries", that accepts a list in
the form:

   preload_libraries = '$libdir/mylib1:initfunc,$libdir/mylib2'

If ":initfunc" is omitted or not found, no initialization function is
executed, but the library is still preloaded. If "$libdir/mylib" isn't
found, the postmaster refuses to start.

In my testing with PL/R, it reduces the first call to a PL/R function
(after connecting) from almost 2 seconds, down to about 8 ms.

Joe Conway
2003-03-20 04:51:44 +00:00
Bruce Momjian e733510d5d > Mph. It fails for me too when I use --enable-integer-datetimes. Looks
> like that patch still needs some work...

Yeah.  I'm really, really, *really* sorry for submitting it in the state
it was in.  I shouldn't have done that just before moving to another
country.  I found the problem last night, but couldn't get to a Net
connection until now.

The problem is in src/bin/psql/common.c, around line 250-335 somewhere
depending on the version.  The 2nd and 3rd clauses of the "while" loop
condition:

        (rstatus == PGRES_COPY_IN) &&
        (rstatus == PGRES_COPY_OUT))

should of course be:

        (rstatus != PGRES_COPY_IN) &&
        (rstatus != PGRES_COPY_OUT))

Jeroen T. Vermeulen
2003-03-20 04:49:18 +00:00
Bruce Momjian 7d1d7200a0 Minor doc patch: create function
Gavin Sherry
2003-03-20 04:41:13 +00:00
Bruce Momjian ee303739d3 Just some fixups to a couple contrib directories I was trying out.
. replace CREATE OR REPLACE AGGREGATE with a separate DROP and CREATE
. add DROP for all CREATE OPERATORs
. use IMMUTABLE and STRICT instead of WITH (isStrict)
. add IMMUTABLE and STRICT to int_array_aggregate's accumulator function

Gregory Stark
2003-03-20 04:39:27 +00:00
Bruce Momjian 900fa3d0f5 The attatched patch fixes a memory error with contrib/dbmirror/pending.c
when running it with older(Pre 7.3.x) versions of Postgresql.

Backpatched to 7.3.X.

Steven Singer
2003-03-20 03:58:13 +00:00
Bruce Momjian 31ce4557b3 Item done:
> * -Add start time to pg_stat_activity
2003-03-20 03:40:33 +00:00
Bruce Momjian a18331004a Add start time to pg_stat_activity
Neil Conway
2003-03-20 03:34:57 +00:00
Bruce Momjian ddd50a0bab This patch fixes a very small memory leak in psql, spotted with
valgrind.

Neil Conway
2003-03-19 22:49:43 +00:00
Bruce Momjian 1ef7ba20e7 Remove typecasting section that isn't needed anymore. 2003-03-19 21:20:52 +00:00
Peter Eisentraut 8cb041aada Set up the privileges on the default schemas in initdb with real GRANT
commands, to arrive at a valid and dumpable state.
2003-03-19 16:08:59 +00:00
Peter Eisentraut 28efaf3ccd Avoid mysterious warning about possibly uninitialized variable. 2003-03-19 16:05:41 +00:00
Barry Lind 44a6959f4a Applied patch to work around server bug.
Modified Files:
 	jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java
2003-03-19 04:06:20 +00:00
Bruce Momjian c085c771d3 Fix typo:
< * Rod is Rod Taylor <pg@rbt.ca)>
> * Rod is Rod Taylor <pg@rbt.ca>
2003-03-19 03:53:21 +00:00
Peter Eisentraut 9e0ab7126d Reimplement create and drop scripts in C, to reduce repetitive
connections, increase robustness, add NLS, and prepare for Windows port.
(vacuumdb and clusterdb will follow later.)
2003-03-18 22:19:47 +00:00
Peter Eisentraut cf1cf89649 Make the printing code somewhat more independent by not relying on
functions and global variables from the rest of psql.  Also clean up some
data type mismatches created by the last pager patch.
2003-03-18 22:15:44 +00:00
Peter Eisentraut 9384dc6e59 Improve error message. 2003-03-18 22:11:48 +00:00
Peter Eisentraut a14424a9d2 Fix off-by-one error in the maxlen parameter handling. 2003-03-18 22:09:37 +00:00
Bruce Momjian 6cf8ce13db Compiling anything that uses InvalidOid under g++ yields a warning about
the expression using an "old-style cast."  Therefore, would it be okay
to patch postgres_ext.h as follows:

Jeroen T. Vermeulen
2003-03-18 17:21:07 +00:00
Bruce Momjian 526de7ffd1 Remove duplicate ANALYZE recommendation in pg_dump. 2003-03-18 17:05:01 +00:00
Michael Meskes 6fad73ed45 Some bugfixes for numerical library. 2003-03-18 10:46:39 +00:00
Barry Lind a6f00f3939 Applied updated translation patch
Modified Files:
 	errors_zh_TW.properties
2003-03-18 05:26:50 +00:00
Bruce Momjian 6fdd71c133 Add to mmap discussion. 2003-03-18 01:36:01 +00:00
Bruce Momjian 29c18bca50 Add mention of ANALYZE after object restore. 2003-03-18 00:02:11 +00:00
Bruce Momjian ccfa6f1c1e Add mention of new sets returning functions capability. 2003-03-17 19:53:08 +00:00
Bruce Momjian 77312655a9 Update links, from Ian Barwick 2003-03-17 19:47:28 +00:00
Bruce Momjian b776fc198b Add:
> * Allow UPDATE tab SET ROW (col, ...) = (...) for updating multiple columns
2003-03-17 18:50:06 +00:00
Bruce Momjian 93b408ef86 Reorder crypt.h include for SunOS compile problem.
Fred Houweling
2003-03-17 17:58:57 +00:00
Bruce Momjian aac4484345 Increase max known database size. 2003-03-17 16:33:12 +00:00
Michael Meskes bb3730893b Forgot some files... 2003-03-16 10:49:51 +00:00
Michael Meskes a4f25b6a9c Started working on a seperate pgtypes library. First test work. PLEASE test compilation on iother systems. 2003-03-16 10:42:54 +00:00
Tom Lane 48dfa0d057 Arrange to print the relevant key values when reporting a foreign-key
violation.  Also, factor out some duplicate code in the RI triggers.
Patch by Dmitry Tkach, reviewed by Stephan Szabo and Tom Lane.
2003-03-15 21:19:40 +00:00
Bruce Momjian 35911088ff A typo in src/backend/libpq/hba.c breaks local ident authentication
in the SO_PEERCRED case. elif is misspelled as elsif for the test.
A patch is attached.

Bruno Wolff III
2003-03-15 16:18:25 +00:00
Tom Lane 2a44306396 pg_dumpall failed on groups having no members. Per report from
Nick Eskelinen.
2003-03-14 22:45:49 +00:00
Bruce Momjian c90354bad0 Remove unneeded dash blocks around function start comments. 2003-03-14 22:40:31 +00:00
Bruce Momjian dc95c9f3ab Update name of GUC var:
< * Add GUC log_statement_duration to print statement and >= min duration
> * Add GUC log_statement_and_duration to print statement and >= min duration
2003-03-14 20:19:59 +00:00
Bruce Momjian 96fecb54dc Add:
> * Add GUC log_statement_duration to print statement and >= min duration
2003-03-14 19:27:49 +00:00
Barry Lind 9f66350b0e Fixed parsing to handle \n for updateable result sets. Bug reported by Rich Cullingford.
Modified Files:
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
2003-03-14 05:36:58 +00:00
Tom Lane a6bf340975 Repair incorrect prorettype entry for timestamptz_izone. Can't force
initdb in the 7.3 branch, but we can at least make it right for people
who install 7.3.3 from scratch.
2003-03-14 04:43:52 +00:00
Barry Lind 77ce53580b Improved error message and added some log messages in batch update functionality
Modified Files:
 	jdbc/org/postgresql/errors.properties
 	jdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java
 	jdbc/org/postgresql/util/PSQLException.java
2003-03-14 01:21:47 +00:00
Tom Lane 7931bfa764 Make eval_const_expressions simplify FieldSelect from a whole-row Var
into an ordinary one-field Var.  Per example from Chris Mungall.
2003-03-14 00:55:17 +00:00
Tom Lane 2a1ef30b57 Prevent infinite loop in ln_var() due to roundoff error.
Per report from Dave Marin.
2003-03-14 00:15:32 +00:00
Tom Lane 6c4996fa6b GROUP BY got confused if there were multiple equal() GROUP BY items.
This bug has been latent since 7.0 or maybe even further back, but it
was only exposed when parse_clause.c stopped suppressing duplicate
items (see its rev 1.96 of 18-Aug-02).
2003-03-13 16:58:35 +00:00
Peter Eisentraut 706a32cdf6 Big editing for consistent content and presentation. 2003-03-13 01:30:29 +00:00
Tom Lane 31e69ccb21 Add explicit tests for division by zero to all user-accessible integer
division and modulo functions, to avoid problems on OS X (which fails to
trap 0 divide at all) and Windows (which traps it in some bizarre
nonstandard fashion).  Standardize on 'division by zero' as the one true
spelling of this error message.  Add regression tests as suggested by
Neil Conway.
2003-03-11 21:01:33 +00:00