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.