[SQL] Create Type with typmod_in

2011-11-04 Thread Russell Keane
I'm trying to create a custom type (PostgreSQL 9.0) which will essentially auto truncate a string to a certain length. The type (auto_trunc_char) will be used as follows: Create table blah ( Some_name auto_trunc_char(40) ) Can this be done purely in plpgsql? If so, how? I know

Re: [SQL] Create Type with typmod_in

2011-11-04 Thread David Johnston
On Nov 4, 2011, at 10:01, Russell Keane russell.ke...@inps.co.uk wrote: I’m trying to create a custom type (PostgreSQL 9.0) which will essentially auto truncate a string to a certain length. Can this be done purely in plpgsql? If so, how? An explicit cast of a value to

[SQL] the use of $$string$$

2011-11-04 Thread John Fabiani
Hi, I just discovered that I can use $$string$$ to account for the problem of single quotes in the string (or other strange char's). However, I noticed that the table field contained E'string'. I actually tried to find info on this but I did not find anything. Could someone explain what it

Re: [SQL] the use of $$string$$

2011-11-04 Thread bricklen
On Fri, Nov 4, 2011 at 7:38 AM, John Fabiani jo...@jfcomputer.com wrote: Hi, I just discovered that I can use $$string$$ to account for the problem of single quotes in the string (or other strange char's).  However, I noticed that the table field contained E'string'.  I actually tried to find

Re: [SQL] the use of $$string$$

2011-11-04 Thread Tom Lane
John Fabiani jo...@jfcomputer.com writes: I just discovered that I can use $$string$$ to account for the problem of single quotes in the string (or other strange char's). However, I noticed that the table field contained E'string'. I actually tried to find info on this but I did not find

Re: [SQL] the use of $$string$$

2011-11-04 Thread John Fabiani
On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: Hi, I just discovered that I can use $$string$$ to account for the problem of single quotes in the string (or other strange char's). However, I noticed that the table field contained E'string'. I actually tried to find info on

Re: [SQL] the use of $$string$$

2011-11-04 Thread David Johnston
On Nov 4, 2011, at 11:26, John Fabiani jo...@jfcomputer.com wrote: On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: Hi, I just discovered that I can use $$string$$ to account for the problem of single quotes in the string (or other strange char's). However, I noticed that the

Re: [SQL] the use of $$string$$

2011-11-04 Thread John Fabiani
On Friday, November 04, 2011 09:05:19 am David Johnston wrote: On Nov 4, 2011, at 11:26, John Fabiani jo...@jfcomputer.com wrote: On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: Hi, I just discovered that I can use $$string$$ to account for the problem of single quotes in the

Re: [SQL] the use of $$string$$

2011-11-04 Thread Richard Huxton
On 04/11/11 15:26, John Fabiani wrote: On Friday, November 04, 2011 07:38:29 am John Fabiani wrote: Hi, I just discovered that I can use $$string$$ to account for the problem of single quotes in the string (or other strange char's). However, I noticed that the table field contained E'string'.

[SQL] How to implement Aggregate Awareness?

2011-11-04 Thread Olgierd Michalak
I wonder how to implement Aggregate Awareness or Transparent Aggregate Navigation in PostgreSQL? Simply put, when Transparent (to the reporting tool) Aggregate Navigator recognizes that a query would execute faster using aggregates, it automatically rewrites the query so that the database hits