From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Frank_Lupo Frank_Lupo <frank_lupo(at)telemail(dot)it> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: big problem |
Date: | 2002-03-11 17:14:41 |
Message-ID: | 20020311090523.J45259-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-03-11 17:16:56 | Re: FROM Clause subquery |
Previous Message | Bruce Momjian | 2002-03-11 17:09:34 | Re: [HACKERS] Nice Oracle tuning article |