Re: [GENERAL] Array string casts with SELECT but not SELECT DISTINCT

2015-02-21 Thread David G Johnston
On Sat, Feb 21, 2015 at 7:11 PM, Ken Tanzer [via PostgreSQL] < ml-node+s1045698n583889...@n5.nabble.com> wrote: > I tried that and it does indeed work. (With, of course, the appropriate > permissions to create the cast.) > > So this makes me wonder--is there any downside or unwelcome side effects

Re: [GENERAL] Array string casts with SELECT but not SELECT DISTINCT

2015-02-21 Thread sridhar bamandlapally
Currently, this we are running in production, not faced any issues with functional or performance or database maintenance, I am talking about banking related application As per my knowledge/experience this should work without any downside, and, this cast creation method is part of postgresql docu

Re: [GENERAL] Array string casts with SELECT but not SELECT DISTINCT

2015-02-21 Thread Ken Tanzer
I tried that and it does indeed work. (With, of course, the appropriate permissions to create the cast.) So this makes me wonder--is there any downside or unwelcome side effects to having such a cast? And if not, why isn't it part of the default setup? Cheers, Ken On Sat, Feb 21, 2015 at 3:34 A

Re: [GENERAL] Array string casts with SELECT but not SELECT DISTINCT

2015-02-21 Thread sridhar bamandlapally
Hi Please see below, this works, way for implicit type casting bns=# CREATE TEMP TABLE foo (my_array varchar[]); CREATE TABLE bns=# bns=# INSERT INTO foo (my_array) SELECT '{TEST}'; INSERT 0 1 bns=# bns=# SELECT my_array[1],array_length(my_array,1) FROM foo; my_array | array_length --+--

Re: [GENERAL] Array string casts with SELECT but not SELECT DISTINCT

2015-02-20 Thread Ken Tanzer
I'm not able to run this unless I'm the Postgres super user. But if I run it as such, it tells me that cast already exists anyway. CREATE CAST (text AS varchar) WITH INOUT AS IMPLICIT; ERROR: cast from type text to type character varying already exists Of course this will work fine: INSERT INTO

Re: [GENERAL] Array string casts with SELECT but not SELECT DISTINCT

2015-02-20 Thread David G Johnston
On Fri, Feb 20, 2015 at 7:31 PM, sridhar bamandlapally [via PostgreSQL] < ml-node+s1045698n5838807...@n5.nabble.com> wrote: > >>>ERROR: column "my_array" is of type character varying[] but expression > is of type text > > please try this below, may be this should help > > CREATE CAST (text AS var

Re: [GENERAL] Array string casts with SELECT but not SELECT DISTINCT

2015-02-20 Thread sridhar bamandlapally
>>>ERROR: column "my_array" is of type character varying[] but expression is of type text please try this below, may be this should help CREATE CAST (text AS varchar) WITH INOUT AS IMPLICIT; just for info: actually this should be available in default On Fri, Feb 20, 2015 at 9:48 AM, Ken Tanze

Re: [GENERAL] Array string casts with SELECT but not SELECT DISTINCT

2015-02-19 Thread David G Johnston
Ken Tanzer wrote > ag_reach_test=> INSERT INTO foo (my_array) SELECT DISTINCT '{TEST}'; > ERROR: column "my_array" is of type character varying[] but expression is > of type text > LINE 1: INSERT INTO foo (my_array) SELECT DISTINCT '{TEST}'; >^ >

[GENERAL] Array string casts with SELECT but not SELECT DISTINCT

2015-02-19 Thread Ken Tanzer
Hi. Here's a boiled down example of something that caught me by surprise: ag_reach_test=> CREATE TEMP TABLE foo (my_array varchar[]); CREATE TABLE ag_reach_test=> INSERT INTO foo (my_array) SELECT '{TEST}'; INSERT 0 1 ag_reach_test=> SELECT my_array[1],array_length(my_array,1) FROM foo; my_array