Re: big problem
От | Stephan Szabo |
---|---|
Тема | Re: big problem |
Дата | |
Msg-id | 20020311090523.J45259-100000@megazone23.bigpanda.com обсуждение исходный текст |
Ответ на | big problem (Frank_Lupo Frank_Lupo <frank_lupo@telemail.it>) |
Список | pgsql-general |
On Mon, 11 Mar 2002, Frank_Lupo Frank_Lupo wrote: > My verions of postgres is 7.2 in window2000. > ========================= ================== > select 'aaa'+'aaa'; > return : > ?column? > ---------- > ? > ???????????? You probably want || (the concatenation operator) rather than defining your own. > I creata function and operator +: > CREATE FUNCTION "varcharcat"("varchar", "varchar") RETURNS "text" AS 'select textcat($1,$2)' LANGUAGE 'sql'; > COMMENT ON FUNCTION "varcharcat"("varchar", "varchar") IS 'concatenate'; > > CREATE OPERATOR + (PROCEDURE = "varcharcat", LEFTARG = "varchar", RIGHTARG = "varchar"); > > The resul is ok but : > select 'aaa'+'aaa'; > ERROR: Unable to identify an operator '+' for types 'unknown' and 'unknown' > You will have to retype this query using an explicit cast > ERROR: Unable to identify an operator '+' for types 'unknown' and 'unknown' > You will have to retype this query using an explicit cast The only thing I can think of is that it might have multiple operators that it's considering and can't decide. It seemed to work for me if I defined it over text. > > ========================= ================== > Problem in insert > > CREATE TABLE "irelbcmb" ( > "id" int4, > "id_pad" int4, > "desc" int4, > "cod" varchar(40), > "sys_var" varchar(1), > "nom_var" varchar(16) > ) WITH OIDS; > > gedis30=# insert into irelbcmb (id,id_pad,desc,cod,sys_var,nom_var) values 1,1,1,"pippo","1","pippo"); > ERROR: parser: parse error at or near "desc" desc is probably reserved (given order by ... desc), use double quotes around the name. In fact, if you create using double quotes, you should probably always use double quotes around the names. In addition, you're missing the open paren after values and you want single quotes not double on the last thress trings.
В списке pgsql-general по дате отправления: