Changeset: 356f67458c17 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/356f67458c17
Added Files:
        sql/test/copy/Tests/decimal_separators.test
Modified Files:
        sql/test/copy/Tests/All
Branch: default
Log Message:

Add a test


diffs (105 lines):

diff --git a/sql/test/copy/Tests/All b/sql/test/copy/Tests/All
--- a/sql/test/copy/Tests/All
+++ b/sql/test/copy/Tests/All
@@ -4,6 +4,7 @@ escaped_char
 null_as_string
 null_as_string_errors
 null_as_string_output
+decimal_separators
 int_parse_best
 int_parse
 load_stdin_incorrect_line_nr
diff --git a/sql/test/copy/Tests/decimal_separators.test 
b/sql/test/copy/Tests/decimal_separators.test
new file mode 100644
--- /dev/null
+++ b/sql/test/copy/Tests/decimal_separators.test
@@ -0,0 +1,89 @@
+statement ok
+START TRANSACTION
+
+statement ok
+CREATE TABLE decimals(id INT, d DECIMAL(8,2))
+
+--
+-- this is the default behavior
+--
+
+statement ok
+COPY 3 RECORDS INTO decimals FROM STDIN
+<COPY_INTO_DATA>
+1| 123.45
+2|+123.45
+3|-123.45
+
+query T
+SELECT d FROM decimals ORDER BY id
+----
+123.45
+123.45
+-123.45
+
+statement ok
+DELETE FROM decimals
+
+--
+-- customize the decimal separator
+--
+
+statement ok
+COPY 3 RECORDS INTO decimals FROM STDIN DECIMAL AS ','
+<COPY_INTO_DATA>
+1| 123,45
+2|+123,45
+3|-123,45
+
+query T
+SELECT d FROM decimals ORDER BY id
+----
+123.45
+123.45
+-123.45
+
+statement ok
+DELETE FROM decimals
+
+--
+-- also set a thousands separator
+--
+
+statement ok
+COPY 3 RECORDS INTO decimals FROM STDIN DECIMAL AS ',', '_'
+<COPY_INTO_DATA>
+1| 1_23,45
+2|+1_23,45
+3|-1_23,45
+
+query T
+SELECT d FROM decimals ORDER BY id
+----
+123.45
+123.45
+-123.45
+
+statement ok
+DELETE FROM decimals
+
+--
+-- the 'AS' is optional
+--
+
+statement ok
+COPY 3 RECORDS INTO decimals FROM STDIN DECIMAL ',', '_'
+<COPY_INTO_DATA>
+1| 1_23,45
+2|+1_23,4__5
+3|-1_23,_45
+
+query T
+SELECT d FROM decimals ORDER BY id
+----
+123.45
+123.45
+-123.45
+
+statement ok
+DELETE FROM decimals
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to