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 exist
Unable to identify a function that satisfies the given argument types
You may 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.
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly