Lists: | pgsql-hackers |
---|
From: | Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | quoting bug? |
Date: | 2008-02-09 16:50:57 |
Message-ID: | 20080209165057.GD6126@quartz.itdept.newn.cam.ac.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Given the following trivial trigger example:
-- create language plpgsql;
create table foo (a integer, b text, c timestamp);
create function foo_insert() returns trigger as $$
begin
raise notice '%', new;
return null;
end;
$$ language plpgsql;
create trigger foo_ins before insert on foo
for each row execute procedure foo_insert();
insert into foo values (1, 'two', current_timestamp);
I am surprised to see
NOTICE: (1,two,"Sat 09 Feb 16:47:44.514503 2008")
INSERT 0 0
I would have expected
NOTICE: (1,'two','Sat 09 Feb 16:47:44.514503 2008')
INSERT 0 0
i.e., a row whose columns look as though they went through quote_literal
rather than through quote_ident.
This is with yesterday's 8.3.0 (Feb 8 17:24 GMT)
Thoughts?
Cheers,
Patrick
From: | "Brendan Jurd" <direvus(at)gmail(dot)com> |
---|---|
To: | "Patrick Welche" <prlw1(at)newn(dot)cam(dot)ac(dot)uk> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: quoting bug? |
Date: | 2008-02-09 17:12:18 |
Message-ID: | 37ed240d0802090912l638de73dj9315c7a7dca2c8c5@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Feb 10, 2008 3:50 AM, Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk> wrote:
> NOTICE: (1,two,"Sat 09 Feb 16:47:44.514503 2008")
> INSERT 0 0
>
I think what you're seeing is the syntax for row literals.
You can get an idea of how it looks without having to write trigger
functions, e.g.:
> select row(1, 'second value', current_timestamp);
row
-----------------------------------
(1,"second value","2008-02-10 04:00:54.458647+11")
(1 row)
Note that anything which includes spaces, commas or brackets is double-quoted.
You can see it working the other way around by constructing a record
using the literal syntax.
=> create type foo as (a text, b int);
CREATE TYPE
=> select '("one", 2)'::foo;
foo
---------
(one,2)
(1 row)
Cheers,
BJ
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: quoting bug? |
Date: | 2008-02-09 17:29:10 |
Message-ID: | 25003.1202578150@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk> writes:
> I am surprised to see
> NOTICE: (1,two,"Sat 09 Feb 16:47:44.514503 2008")
This is the expected formatting for a composite type. Read
http://www.postgresql.org/docs/8.3/static/rowtypes.html#AEN6266
regards, tom lane
From: | Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk> |
---|---|
To: | Brendan Jurd <direvus(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: quoting bug? |
Date: | 2008-02-09 18:26:22 |
Message-ID: | 20080209182622.GE6126@quartz.itdept.newn.cam.ac.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sat, Feb 09, 2008 at 12:29:10PM -0500, Tom Lane wrote:
> Patrick Welche <prlw1(at)newn(dot)cam(dot)ac(dot)uk> writes:
> > I am surprised to see
>
> > NOTICE: (1,two,"Sat 09 Feb 16:47:44.514503 2008")
>
> This is the expected formatting for a composite type. Read
> http://www.postgresql.org/docs/8.3/static/rowtypes.html#AEN6266
Thank you - sorry for noise.
Patrick