Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea066f8

Browse files
committed
Document that "Q" is ignored by to_date and to_timestamp. Add C comment
about the behavior.Document that quotes in to_date, to_timestamp, to_number skip inputcharacters.
1 parent61d7511 commitea066f8

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.506 2010/02/23 16:14:25 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.507 2010/03/03 22:28:42 momjian Exp $ -->
22

33
<chapter id="functions">
44
<title>Functions and Operators</title>
@@ -5089,7 +5089,7 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
50895089
</row>
50905090
<row>
50915091
<entry><literal>Q</literal></entry>
5092-
<entry>quarter</entry>
5092+
<entry>quarter (ignored by <function>to_date</> and <function>to_timestamp</>)</entry>
50935093
</row>
50945094
<row>
50955095
<entry><literal>RM</literal></entry>
@@ -5209,7 +5209,10 @@ SELECT SUBSTRING('XY1234Z', 'Y*?([0-9]{1,3})');
52095209
even if it contains pattern key words. For example, in
52105210
<literal>'"Hello Year "YYYY'</literal>, the <literal>YYYY</literal>
52115211
will be replaced by the year data, but the single <literal>Y</literal> in <literal>Year</literal>
5212-
will not be.
5212+
will not be. In <function>to_date</>, <function>to_number</>,
5213+
and <function>to_timestamp</>, double-quoted strings skip the number of
5214+
input characters contained in the string, e.g. <literal>"XX"</>
5215+
skips two input characters.
52135216
</para>
52145217
</listitem>
52155218

‎src/backend/utils/adt/formatting.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* formatting.c
33
*
4-
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.168 2010/02/26 02:01:08 momjian Exp $
4+
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.169 2010/03/03 22:28:42 momjian Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2010, PostgreSQL Global Development Group
@@ -2671,10 +2671,12 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out)
26712671
s+=SKIP_THth(n->suffix);
26722672
break;
26732673
caseDCH_Q:
2674-
26752674
/*
2676-
* We ignore Q when converting to date because it is not
2677-
* normative.
2675+
* We ignore 'Q' when converting to date because it is
2676+
* unclear which date in the quarter to use, and some
2677+
* people specify both quarter and month, so if it was
2678+
* honored it might conflict with the supplied month.
2679+
* That is also why we don't throw an error.
26782680
*
26792681
* We still parse the source string for an integer, but it
26802682
* isn't stored anywhere in 'out'.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp