Explicite typecasting of functions
От | Andreas Tille |
---|---|
Тема | Explicite typecasting of functions |
Дата | |
Msg-id | Pine.LNX.4.44.0208141123010.8253-100000@wr-linux02.rki.ivbb.bund.de обсуждение исходный текст |
Ответы |
Re: Explicite typecasting of functions
|
Список | pgsql-sql |
Hello, I want to insert new data into a table with increasing data set ids. The table has two separate "regions" of data: Those with Ids below 1000000 and other. If I want to create a new Id in the "lower region" I tried the following (simplified example): CREATE TABLE Items ( Id int DEFAULT NextItem() ) ; /* ERROR: Function 'nextitem()' does not existUnable to identify a function that satisfies the given argument typesYoumay need to add explicit typecasts*/ CREATE FUNCTION NextItem() RETURNS INT4 AS 'select max(Id)+1 from Items where Id < 1000000;' LANGUAGE 'sql'; I did not found any trace of documentation how to do an explicit typecast for the function. Defining the function first fails because: ERROR: Relation "items" does not exist Any hint to solve this kind of chicken-egg-problem? Kind regards Andreas.
В списке pgsql-sql по дате отправления: