create c function with void argument bug?
create c function with void argument bug?
От:
"A.M." <agentm@themactionfaction.com>
Дата:
Hello, It seems that this: CREATE OR REPLACE FUNCTION test_fsync_speed() RETURNS float AS '$libdir/test_fsync_speed','\ test_fsync_speed' LANGUAGE C IMMUTABLE STRICT; is not equivalent to this (note "void" argument): CREATE OR REPLACE FUNCTION test_fsync_speed(void) RETURNS float AS '$libdir/test_fsync_speed','\ test_fsync_speed' LANGUAGE C IMMUTABLE STRICT; Two functions are created. test=# \df List of functionsSchema | Name | Result data type | Argument data types | Type --------+------------------+------------------+---------------------+--------public | test_fsync_speed | double precision | | normalpublic | test_fsync_speed | double precision | void | normal Furthermore, I can't figure out how to call the "void" argument variant. Why is void accepted as an argument? create function testvoid(void) returns void as '' LANGUAGE PLPGSQL; ERROR: PL/pgSQL functions cannot accept type void I punched the void argument in just by chance- am I just stupid? Cheers, M
Re: create c function with void argument bug?
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"A.M." writes: > It seems that this: > CREATE OR REPLACE FUNCTION test_fsync_speed() RETURNS float AS '$libdir/test_fsync_speed','\ > test_fsync_speed' LANGUAGE C IMMUTABLE STRICT; > is not equivalent to this (note "void" argument): > CREATE OR REPLACE FUNCTION test_fsync_speed(void) RETURNS float AS '$libdir/test_fsync_speed','\ > test_fsync_speed' LANGUAGE C IMMUTABLE STRICT; Why would you think it would be? "void" in SQL doesn't act the same way as "void" in C, it's an actual type. regards, tom lane