pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedfunction length(numeric) does not exist
3+ messages / 3 participants
[nested] [flat]
* function length(numeric) does not exist
@ 2014-11-22 12:26 Ricardo Sardinha <ricardo.sardinha@ti.polynorte.com.br>
0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Sardinha @ 2014-11-22 12:26 UTC (permalink / raw)
To: pgsql-bugs
Version: PostgreSQL 9.2.6, compiled by Visual C++ build 1600, 32-bit
When I try to use the function length occurs the error:
"ERRO: 42883: função length(numeric) não existe" (function length(numeric)
does not exist).
Then I try to create length function:
CREATE OR REPLACE FUNCTION length(tsvector)
RETURNS int4 AS
'$libdir/tsearch2', 'tsvector_length'
LANGUAGE 'c' IMMUTABLE STRICT;
ALTER FUNCTION length(tsvector) OWNER TO postgres;
But the return is:
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--------
ERRO: não pôde encontrar função "tsvector_length" no arquivo "C:/Program
Files/PostgreSQL/9.2/lib/tsearch2.dll"
(could not find function "tsvector_length" in the file "C:/Program
Files/PostgreSQL/9.2/lib/tsearch2.dll")
********** Error **********
ERRO: não pôde encontrar função "tsvector_length" no arquivo "C:/Program
Files/PostgreSQL/9.2/lib/tsearch2.dll"
(could not find function "tsvector_length" in the file "C:/Program
Files/PostgreSQL/9.2/lib/tsearch2.dll")
SQL state: 42883
----------------------------------------------------------------------------
----------------------------------------------------------------------------
--------
I need the help!
Thanks!
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: function length(numeric) does not exist
@ 2014-11-25 00:04 Michael Paquier <michael.paquier@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Michael Paquier @ 2014-11-25 00:04 UTC (permalink / raw)
To: Ricardo Sardinha <ricardo.sardinha@ti.polynorte.com.br>; +Cc: pgsql-bugs
On Sat, Nov 22, 2014 at 9:26 PM, Ricardo Sardinha <
ricardo.sardinha@ti.polynorte.com.br> wrote:
> "ERRO: 42883: função length(numeric) não existe" (*function
> length(numeric) **does not exist*).
>
length() is not able to accept numeric as input.
=# select length(123.45);
ERROR: 42883: function length(numeric) does not exist
LINE 1: select length(123.45);
You could cast it to text depending on what you want to do:
=# select length(123.45::text);
length
--------
6
(1 row)
Then I try to create *length* function:
>
>
>
> CREATE OR REPLACE FUNCTION length(tsvector)
>
> RETURNS int4 AS
>
> '$libdir/tsearch2', 'tsvector_length'
>
> LANGUAGE 'c' IMMUTABLE STRICT;
>
> ALTER FUNCTION length(tsvector) OWNER TO postgres;
>
That's because this function is not defined in the extension tsearch2, but
is part of core, so you actually do not need to redefine it:
=# \dfS length
List of functions
Schema | Name | Result data type | Argument data types | Type
------------+--------+------------------+---------------------+--------
pg_catalog | length | integer | bit | normal
pg_catalog | length | integer | bytea | normal
pg_catalog | length | integer | bytea, name | normal
pg_catalog | length | integer | character | normal
pg_catalog | length | double precision | lseg | normal
pg_catalog | length | double precision | path | normal
pg_catalog | length | integer | text | normal
pg_catalog | length | integer | tsvector | normal
(8 rows)
Regards,
--
Michael
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: function length(numeric) does not exist
@ 2014-11-25 00:17 David G Johnston <david.g.johnston@gmail.com>
parent: Ricardo Sardinha <ricardo.sardinha@ti.polynorte.com.br>
0 siblings, 0 replies; 3+ messages in thread
From: David G Johnston @ 2014-11-25 00:17 UTC (permalink / raw)
To: pgsql-bugs
Ricardo Sardinha wrote
> Version: PostgreSQL 9.2.6, compiled by Visual C++ build 1600, 32-bit
> "ERRO: 42883: função length(numeric) não existe" (function length(numeric)
> does not exist).
>
> Then I try to create length function:
>
> CREATE OR REPLACE FUNCTION length(tsvector)
I'm confused...you try and pass a numeric into a length function and when
that doesn't work you go and create a length function that takes a tsvector?
Until you communicate what it is you are trying to accomplish and, ideally,
provide some code to help explain the same, it is going to be difficult to
provide you with help.
David J.
--
View this message in context: http://postgresql.nabble.com/function-length-numeric-does-not-exist-tp5828067p5828105.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2014-11-25 00:17 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-11-22 12:26 function length(numeric) does not exist Ricardo Sardinha <ricardo.sardinha@ti.polynorte.com.br>
2014-11-25 00:17 ` David G Johnston <david.g.johnston@gmail.com>
2014-11-25 00:04 Re: function length(numeric) does not exist Michael Paquier <michael.paquier@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox