postgresql/src/test/regress/sql
Bruce Momjian 46be0c18f1 > After all that about numbering centuries and millenia correctly,
> why does CVS tip still give me
>
> regression=# select extract(century from now());
>  date_part
> -----------
>         20
> (1 row)
> [ ... looks in code ... ]
>
> Apparently it's because you fixed only timestamp_part, and not
> timestamptz_part.  I'm not too sure about what timestamp_trunc or
> timestamptz_trunc should do, but they may be wrong as well.

Sigh... as usual, what is not tested does not work:-(


> Could we have a more complete patch?

Please find a submission attached. I hope it really fixes all decade,
century and millenium issues for extract and *_trunc functions on
interval
and other timestamp types. If someone could check that the results
are reasonnable, it would be great.

I indeed overlooked the fact that there were two functions. The patch
fixes the code so that both variants agree.

I added comments to interval extractions, because it relies on the C
division to have a negative remainder: -7/10 = 0 and remains -7.

As for *_trunc functions, I have chosen to put the first year of the
century or millennium: -100, 1, 101... 1001 2001 etc. Indeed, I don't
think it would make sense to put 2000 (last year of the 2nd millennium)
for rounding all years of the third millenium.

I also fixed the code so that all decades last 10 years and decade 199
means the 1990's.

I have added some tests that are relevant to deal with tricky cases. The
formula may be simplified, but all these cases must pass. Please keep
them.

Fabien Coelho
2004-08-20 03:45:14 +00:00
..
abstime.sql Update regress tests to reflect removal of 'current'. 2001-11-21 18:27:25 +00:00
aggregates.sql The added aggregates are: 2004-05-26 15:26:28 +00:00
alter_table.sql ALTER TABLE rewrite. New cool stuff: 2004-05-05 04:48:48 +00:00
arrays.sql Support assignment to subfields of composite columns in UPDATE and INSERT. 2004-06-09 19:08:20 +00:00
bit.sql Make bit and bit varying types reject too long input. (They already tried 2001-05-22 16:37:17 +00:00
boolean.sql Clean up syntax to use SQL92-ish type coersion 2000-01-04 16:21:02 +00:00
box.sql Implement column aliases on views "CREATE VIEW name (collist)". 2000-03-14 23:06:59 +00:00
btree_index.sql Clean up header for uniform appearance throughout tests. 2000-01-06 06:41:55 +00:00
case.sql Clean up header for uniform appearance throughout tests. 2000-01-06 06:41:55 +00:00
char.sql Make char(n) and varchar(n) types raise an error if the inserted string is 2001-05-21 16:54:46 +00:00
circle.sql Create a 'type cache' that keeps track of the data needed for any particular 2003-08-17 19:58:06 +00:00
cluster.sql OK, here's the final version of ALTER TABLE ... SET WITHOUT CLUSTER. 2004-06-02 21:01:10 +00:00
comments.sql Implement nested block comments in the backend and in psql. 2000-07-14 15:43:57 +00:00
conversion.sql COMMENT ON casts, conversions, languages, operator classes, and 2003-11-21 22:32:49 +00:00
copy2.sql Clean up generation of default names for constraints, indexes, and serial 2004-06-10 17:56:03 +00:00
create_aggregate.sql COMMENT ON casts, conversions, languages, operator classes, and 2003-11-21 22:32:49 +00:00
create_index.sql COMMENT ON casts, conversions, languages, operator classes, and 2003-11-21 22:32:49 +00:00
create_misc.sql Todo items: 2003-03-20 07:02:11 +00:00
create_operator.sql Attached is a patch implementing factorial(), returning numeric. Points 2003-12-01 21:52:38 +00:00
create_table.sql Make char(n) and varchar(n) types raise an error if the inserted string is 2001-05-21 16:54:46 +00:00
create_type.sql COMMENT ON casts, conversions, languages, operator classes, and 2003-11-21 22:32:49 +00:00
create_view.sql COMMENT ON casts, conversions, languages, operator classes, and 2003-11-21 22:32:49 +00:00
date.sql > After all that about numbering centuries and millenia correctly, 2004-08-20 03:45:14 +00:00
domain.sql Require that array literals produce "rectangular" arrays, i.e. all the 2004-08-05 03:30:44 +00:00
drop.sql Add a bunch of pseudo-types to replace the behavior formerly associated 2002-08-22 00:01:51 +00:00
errors.sql Teach psql to show the location of syntax errors visually, per recent 2004-03-14 04:25:18 +00:00
euc_cn.sql Hi, here are the patches to enhance existing MB handling. This time 1998-06-16 07:29:54 +00:00
euc_jp.sql From: t-ishii@sra.co.jp 1998-04-27 17:10:50 +00:00
euc_kr.sql Hi, here are the patches to enhance existing MB handling. This time 1998-06-16 07:29:54 +00:00
euc_tw.sql Add missing mb files. 1999-02-02 19:04:43 +00:00
float4.sql Allow 'Infinity' and '-Infinity' as input to the float4 and float8 2004-03-12 00:25:43 +00:00
float8.sql Add ceiling() as an alias for ceil(), and power() as an alias for pow(). 2004-04-23 20:32:20 +00:00
foreign_key.sql Label CVS tip as 8.0devel instead of 7.5devel. Adjust various comments 2004-08-04 21:34:35 +00:00
geometry.sql Create a 'type cache' that keeps track of the data needed for any particular 2003-08-17 19:58:06 +00:00
hash_index.sql Clean up header for uniform appearance throughout tests. 2000-01-06 06:41:55 +00:00
horology.sql Add missing operators of the form interval-plus-datetime, as required for 2004-07-02 22:50:23 +00:00
inet.sql Add ipv6 address parsing support to 'inet' and 'cidr' data types. 2003-06-24 22:21:24 +00:00
inherit.sql ALTER TABLE rewrite. New cool stuff: 2004-05-05 04:48:48 +00:00
insert.sql Reports missing values as bad. 2002-04-24 02:22:54 +00:00
int2.sql Revise int2/int4/int8/float4/float8 input routines to allow for 2004-03-11 02:11:14 +00:00
int4.sql Revise int2/int4/int8/float4/float8 input routines to allow for 2004-03-11 02:11:14 +00:00
int8.sql Revise int2/int4/int8/float4/float8 input routines to allow for 2004-03-11 02:11:14 +00:00
interval.sql First phase of FE/BE protocol modifications: new StartupPacket layout 2003-04-17 22:26:02 +00:00
join.sql create_unique_plan() should not discard existing output columns of the 2003-08-07 19:20:24 +00:00
limit.sql Remove LIMIT #,# and suggest LIMIT # OFFSET #, per mailing list discussion. 2001-10-20 02:55:39 +00:00
lseg.sql Clean up format of tests. 2000-01-05 06:07:58 +00:00
mule_internal.sql Hi, here are the patches to enhance existing MB handling. This time 1998-06-16 07:29:54 +00:00
name.sql Changes to documentation and the regression tests for the default 2002-09-07 18:39:05 +00:00
namespace.sql Add CREATE TRIGGER, CREATE INDEX, and CREATE SEQUENCE to the list of 2004-01-11 04:58:17 +00:00
numeric_big.sql Update numeric_big regress test for 7.0. This has apparently been 2000-03-30 07:13:20 +00:00
numeric.sql Implement the width_bucket() function, per SQL2003. This commit only adds 2004-05-14 21:42:30 +00:00
numerology.sql Tweak GROUP BY so that it will still accept result-column names, but only 2000-03-15 23:31:19 +00:00
oid.sql Revise int2/int4/int8/float4/float8 input routines to allow for 2004-03-11 02:11:14 +00:00
oidjoins.sql Update oidjoins regression test to match current catalog structure. 2004-08-04 20:33:49 +00:00
opr_sanity.sql Label CVS tip as 8.0devel instead of 7.5devel. Adjust various comments 2004-08-04 21:34:35 +00:00
path.sql Clean up format of tests. 2000-01-05 06:07:58 +00:00
plpgsql.sql Support "OR condition ..." in plpgsql EXCEPTION clauses to make the syntax 2004-07-31 23:04:58 +00:00
point.sql Clean up format of tests. 2000-01-05 06:07:58 +00:00
polygon.sql Clean up format of tests. 2000-01-05 06:07:58 +00:00
polymorphism.sql Aggregates can be polymorphic, using polymorphic implementation functions. 2003-07-01 19:10:53 +00:00
portals_p2.sql Partial indexes work again, courtesy of Martijn van Oosterhout. 2001-07-16 05:07:00 +00:00
portals.sql Allow DECLARE CURSOR to take parameters from the portal in which it is 2004-08-02 01:30:51 +00:00
prepare.sql Change EXECUTE INTO to CREATE TABLE AS EXECUTE. 2003-07-01 00:04:31 +00:00
privileges.sql Revert patch --- needs more generalized solution. 2004-05-02 13:38:28 +00:00
random.sql Improve random regression tests to fail less frequently. 2004-03-15 15:46:25 +00:00
rangefuncs.sql > Joe Conway <mail@joeconway.com> writes: 2003-07-27 04:35:54 +00:00
reltime.sql Clean up format of tests. 2000-01-05 06:07:58 +00:00
rowtypes.sql Support assignment to subfields of composite columns in UPDATE and INSERT. 2004-06-09 19:08:20 +00:00
rules.sql Add ALSO keyword to CREATE RULE. 2004-03-09 05:05:41 +00:00
sanity_check.sql Replace functional-index facility with expressional indexes. Any column 2003-05-28 16:04:02 +00:00
select_distinct_on.sql Redesign DISTINCT ON as discussed in pgsql-sql 1/25/00: syntax is now 2000-01-27 18:11:50 +00:00
select_distinct.sql Add a basic regression test for IS DISTINCT FROM, which has spent way too 2002-12-13 20:16:11 +00:00
select_having.sql Finish implementation of hashed aggregation. Add enable_hashagg GUC 2002-11-21 00:42:20 +00:00
select_implicit.sql Finish implementation of hashed aggregation. Add enable_hashagg GUC 2002-11-21 00:42:20 +00:00
select_into.sql Remove FROM warning by fixing query. 2000-06-04 17:52:54 +00:00
select_views.sql Clean up header for uniform appearance throughout tests. 2000-01-06 06:41:55 +00:00
select.sql Back out BETWEEN node patch, was causing initdb failure. 2002-07-18 17:14:20 +00:00
sequence.sql COMMENT ON casts, conversions, languages, operator classes, and 2003-11-21 22:32:49 +00:00
sql_ascii.sql Add SQL_ASCII encoding test case 2000-03-06 01:29:54 +00:00
stats.sql With pg_autovacuum becoming increasingly popular it's important to 2003-09-13 16:44:49 +00:00
strings.sql Cause CHAR(n) to TEXT or VARCHAR conversion to automatically strip trailing 2003-05-26 00:11:29 +00:00
subselect.sql Repair recalculation failure for nested sub-SELECTs, per bug report from 2004-05-11 02:21:39 +00:00
temp.sql Backend support for autocommit removed, per recent discussions. The 2003-05-14 03:26:03 +00:00
text.sql Clean up syntax to use SQL92-ish type coersion 2000-01-04 16:21:02 +00:00
time.sql Allow a time zone to be specified (and silently ignored) in the input 2003-01-31 01:08:08 +00:00
timestamp.sql Per a brief conversation with Tom, I've created a patch for adding 2004-03-05 02:41:14 +00:00
timestamptz.sql Per a brief conversation with Tom, I've created a patch for adding 2004-03-05 02:41:14 +00:00
timetz.sql Fix queries to insulate from daylight savings time. 2001-10-31 14:44:23 +00:00
tinterval.sql Add separate regression tests for timetz and the new timestamptz type. 2001-09-28 08:00:11 +00:00
transactions.sql Allow optional SAVEPOINT keyword in RELEASE and ROLLBACK TO, for greater 2004-08-12 19:12:21 +00:00
triggers.sql COMMENT ON casts, conversions, languages, operator classes, and 2003-11-21 22:32:49 +00:00
truncate.sql Transaction safe Truncate 2002-11-23 04:05:52 +00:00
type_sanity.sql Label CVS tip as 8.0devel instead of 7.5devel. Adjust various comments 2004-08-04 21:34:35 +00:00
union.sql Adjust data types in some of the UNION tests to avoid potentially 2003-11-02 22:35:26 +00:00
update.sql This patch adds a new regression test for the UPDATE command. Right 2003-08-26 18:32:23 +00:00
vacuum.sql Add new vacuum regression test files. 2002-07-20 04:58:14 +00:00
varchar.sql Make char(n) and varchar(n) types raise an error if the inserted string is 2001-05-21 16:54:46 +00:00
without_oid.sql Label CVS tip as 8.0devel instead of 7.5devel. Adjust various comments 2004-08-04 21:34:35 +00:00