From: | Платон Малюгин <malugin(dot)p(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Add generate_series(numeric, numeric) |
Date: | 2014-09-29 03:42:29 |
Message-ID: | CAKy6U577RG+qJCMURb3kwKJhPSeCq1mnaW9iBYQDzCLE84OFLw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I am newbie in postgresql development, so i took easy item in Todo list "
Add generate_series(numeric, numeric)". First, i changed function with
analogue funcionality (generate_series_timestamp) and added new object in
pg_proc (object id is 6000). My changes successfully was compiled.
I have found some problems when code was tested. (remark step=1.0)
1) STATEMENT: SELECT generate_series(1.0,6.1);
1: generate_series (typeid = 1700, len = -1, typmod = -1, byval = f)
----
1: generate_series = "1.0" (typeid = 1700, len = -1, typmod = -1, byval =
f)
----
1: generate_series = "2.0" (typeid = 1700, len = -1, typmod = -1, byval =
f)
----
1: generate_series = "3.0" (typeid = 1700, len = -1, typmod = -1, byval =
f)
----
1: generate_series = "4.0" (typeid = 1700, len = -1, typmod = -1, byval =
f)
----
1: generate_series = "5.0" (typeid = 1700, len = -1, typmod = -1, byval =
f)
----
1: generate_series = "6.0" (typeid = 1700, len = -1, typmod = -1, byval =
f)
----
Function work.
2) STATEMENT: SELECT * FROM generate_series(1.0, 6.1)
1: generate_series (typeid = 1700, len = -1, typmod = -1, byval = f)
----
make_result(): NUMERIC w=0 d=0 POS 0001
CURRENT:: NUMERIC w=0 d=1 POS 0001
FINISH:: NUMERIC w=0 d=1 POS 0006 1000
STEP:: NUMERIC w=0 d=0 POS 0001
make_result(): NUMERIC w=0 d=1 POS 0002
CURRENT:: NUMERIC w=32639 d=16255 NEG 0000 .... (more 0000)
And postgres was crashed.
Could you help to find mistakes?
Some questions:
1) Is correct using Numeric in generate_series_numeric_fctx instead of
NumericVar?
2) How do you determine object id for new function? Maybe you're looking
for last object id in catalog directory (src/include/catalog/pg_*.h) and
increase by one last object id.
P.S. Sorry, I have made mistakes in message, because english isn't native
language.
Attachment | Content-Type | Size |
---|---|---|
0001-Add-function-generate_series-numeric-numeric.patch | text/x-patch | 4.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2014-09-29 03:53:32 | Re: INSERT ... ON CONFLICT {UPDATE | IGNORE} |
Previous Message | Tom Lane | 2014-09-29 03:36:12 | Re: jsonb format is pessimal for toast compression |