Thread: Insert strings that contain colons into a table

Insert strings that contain colons into a table

From
lmagnell
Date:
How can I insert multiple strings into a table where the strings contain
colons.  
This case fails:
INSERT INTO wwn (wwn_start,wwn_end) VALUES
('50:06:0B:00:00:C2:86:80','50:06:0B:00:00:C2:86:83');
ERROR:  array value must start with "{" or dimension information at
character 71
LINE 1: ..._start,wwn_end) VALUES ('50:06:0B:00:00:C2:86:80','50:06:0B:...

But this case passes:

INSERT INTO wwn (wwn_start) VALUES ('50:06:0B:00:00:C2:86:80');

Thank you,
Lance



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Insert-strings-that-contain-colons-into-a-table-tp5729104.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.



Re: Insert strings that contain colons into a table

From
"David Johnston"
Date:
> -----Original Message-----
> From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-
> owner@postgresql.org] On Behalf Of lmagnell
> Sent: Friday, October 19, 2012 4:25 PM
> To: pgsql-sql@postgresql.org
> Subject: [SQL] Insert strings that contain colons into a table
> 
> How can I insert multiple strings into a table where the strings contain
colons.
> This case fails:
> 
>  INSERT INTO wwn (wwn_start,wwn_end) VALUES
> ('50:06:0B:00:00:C2:86:80','50:06:0B:00:00:C2:86:83');
> ERROR:  array value must start with "{" or dimension information at
character
> 71 LINE 1: ..._start,wwn_end) VALUES
('50:06:0B:00:00:C2:86:80','50:06:0B:...
> 
> But this case passes:
> 
> INSERT INTO wwn (wwn_start) VALUES ('50:06:0B:00:00:C2:86:80');
> 
> Thank you,
> Lance
> 

The "colon" has nothing to do with it.

It appears that "wwn_end" is defined as an array and not a simple text
value.

You need to provide the table definition for "wwn".

This is a section in the documentation regarding arrays but I am guessing
the use of an array in this situation is a mistake.

http://www.postgresql.org/docs/9.0/interactive/arrays.html

David J.





Re: Insert strings that contain colons into a table

From
lmagnell
Date:

Thank you,  that is the problem.  That column should not have been created as an ARRAY type.

 

Lance

 

From: David Johnston [via PostgreSQL] [mailto:ml-node+[hidden email]]
Sent: Friday, October 19, 2012 4:36 PM
To: Lance Magnell
Subject: Re: Insert strings that contain colons into a table

 

> -----Original Message-----
> From: [hidden email] [mailto:pgsql-sql-
> [hidden email]] On Behalf Of lmagnell
> Sent: Friday, October 19, 2012 4:25 PM
> To: [hidden email]
> Subject: [SQL] Insert strings that contain colons into a table
>
> How can I insert multiple strings into a table where the strings contain
colons.
> This case fails:
>
>  INSERT INTO wwn (wwn_start,wwn_end) VALUES
> ('50:06:0B:00:00:C2:86:80','50:06:0B:00:00:C2:86:83');
> ERROR:  array value must start with "{" or dimension information at
character
> 71 LINE 1: ..._start,wwn_end) VALUES
('50:06:0B:00:00:C2:86:80','50:06:0B:...
>
> But this case passes:
>
> INSERT INTO wwn (wwn_start) VALUES ('50:06:0B:00:00:C2:86:80');
>
> Thank you,
> Lance
>

The "colon" has nothing to do with it.

It appears that "wwn_end" is defined as an array and not a simple text
value.

You need to provide the table definition for "wwn".

This is a section in the documentation regarding arrays but I am guessing
the use of an array in this situation is a mistake.

http://www.postgresql.org/docs/9.0/interactive/arrays.html

David J.




--
Sent via pgsql-sql mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


If you reply to this email, your message will be added to the discussion below:

http://postgresql.1045698.n5.nabble.com/Insert-strings-that-contain-colons-into-a-table-tp5729104p5729107.html

To unsubscribe from Insert strings that contain colons into a table, click here.
NAML



View this message in context: RE: Insert strings that contain colons into a table
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.