my postgresql source code is at c:/mingw/postgresql and instal to C:/msys/1.0/local/pgsql/
I add a function to src\backend\utils\adt\geo_ops.c as the following:
Datum
box_add2(PG_FUNCTION_ARGS)
{
BOX *box = PG_GETARG_BOX_P(0);
Point *p = PG_GETARG_POINT_P(1);
PG_RETURN_BOX_P(box_construct((box->high.x + 2* p->x),
(box->low.x + 2* p->x),
(box->high.y +2* p->y),
(box->low.y + 2* p->y)));
}
there is another similar one(this is the original one):
Datum
box_add(PG_FUNCTION_ARGS)
{
BOX *box = PG_GETARG_BOX_P(0);
Point *p = PG_GETARG_POINT_P(1);
PG_RETURN_BOX_P(box_construct((box->high.x + p->x),
(box->low.x + p->x),
(box->high.y + p->y),
(box->low.y + p->y)));
}
And i also add the declaration to the src\include\utils\geo_decls.h like this:
extern Datum box_add2(PG_FUNCTION_ARGS);
and then I did the following like step by step:
$ cd /c/mingw/postgresql
$ ./configure
....
///as i download the alib, but don't kown where it should be put. so i ignore this, does it
matter????
configure: error: zlib library not found
If you have zlib already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-zlib to disable zlib support.
$ make
...
All of PostgreSQL successfully made. Ready to install.
$ make install
....
PostgreSQL installation complete.
$ initdb -D /usr/local/pgsql/data //before this i add the environments
variableslike this:
PGDATA=C:/msys/1.0/local/pgsql/data
PGHOME=C:/msys/1.0/local/pgsql
PGHOST=localhost
PGPORT=5434
PATH= C:/msys/1.0/local/pgsql/bin
.....
Success. You can now start the database server using:
"C:\msys\1.0\local\pgsql\bin\postgres" -D "C:/msys/1.0/local/pgsql/data"
or
"C:\msys\1.0\local\pgsql\bin\pg_ctl" -D "C:/msys/1.0/local/pgsql/data" -l logfile start
$ pg_ctl start -l logfile
server starting
$ createdb testdb
CREATE DATABASE
then I use pgadminIII to open the database:
just run the scripts:
select box_add(box '((0,0),(1,1))',point'(2,2)')
got:
(3,3),(2,2)
select box_add2(box '((0,0),(1,1))',point'(2,2)')
got:
ERROR: function box_add2(box, point) does not exist
SQL state: 42883
advice:No function matches the given name and argument types. You may need to add explicit type casts.
chars:8
anyone know this??? why this happened? what should I do?
thankyou very much!!!