dbTalk Databases Forums  

Strange Insert Problem

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss Strange Insert Problem in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Lola Lee
 
Posts: n/a

Default Strange Insert Problem - 01-09-2004 , 04:25 AM






I'm having a really strange insert problem, which I cannot figure out.

I have a table in my database, which I created using the following
query (I'm using Postgresql 7.4, if this helps):

CREATE TABLE yarncolor (
yarn_color_id SERIAL,
yarn_id int NULL,
yarn_color_nm varchar(35) NULL,
yarn_color_num varchar(10) NULL,
yarn_color_desc varchar(50) NULL,
discontinued_flg boolean NULL,
yarn_color_lud timestamp NULL,
PRIMARY KEY (yarn_color_id),
FOREIGN KEY (yarn_id)
REFERENCES yarn
);

Everytime I try to insert a record in this table via ColdFusion
generated page, I get this error message (I also get this in
phpPgMyAdmin):

SQL error:
ERROR: column "anemone" does not exist


In statement:
INSERT INTO YarnColortwo (yarn_id, yarn_color_nm, yarn_color_num,
yarn_color_desc, yarn_color_lud) VALUES ( 15, Anemone, 616, whatever,
now() )

I'm at a loss as to why does Postgresql think there is a column named
"anemone". Yes, I tried another string of character and get the same
message. Anyone have an idea what may be going on?


--

Lola - mailto:lola (AT) his (DOT) com
http://www.lolajl.net | Blog at http://www.lolajl.net/blog/
Check out this blog: http://www.denbeste.nu
I'm in Bowie, MD, USA, halfway between DC and Annapolis.


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


Reply With Quote
  #2  
Old   
Bruno LEVEQUE
 
Posts: n/a

Default Re: Strange Insert Problem - 01-09-2004 , 04:38 AM






Hi,

First, in insert, every strings must be quoted. Your query becomes :

INSERT INTO YarnColortwo (yarn_id, yarn_color_nm, yarn_color_num,
yarn_color_desc, yarn_color_lud) VALUES ( 15, 'Anemone', 616,
'whatever', now() ).

Try this and report back.

Bruno



Lola Lee wrote:

Quote:
I'm having a really strange insert problem, which I cannot figure out.

I have a table in my database, which I created using the following
query (I'm using Postgresql 7.4, if this helps):

CREATE TABLE yarncolor (
yarn_color_id SERIAL,
yarn_id int NULL,
yarn_color_nm varchar(35) NULL,
yarn_color_num varchar(10) NULL,
yarn_color_desc varchar(50) NULL,
discontinued_flg boolean NULL,
yarn_color_lud timestamp NULL,
PRIMARY KEY (yarn_color_id),
FOREIGN KEY (yarn_id)
REFERENCES yarn
);

Everytime I try to insert a record in this table via ColdFusion
generated page, I get this error message (I also get this in
phpPgMyAdmin):

SQL error:
ERROR: column "anemone" does not exist


In statement:
INSERT INTO YarnColortwo (yarn_id, yarn_color_nm, yarn_color_num,
yarn_color_desc, yarn_color_lud) VALUES ( 15, Anemone, 616, whatever,
now() )

I'm at a loss as to why does Postgresql think there is a column named
"anemone". Yes, I tried another string of character and get the same
message. Anyone have an idea what may be going on?


--
Bruno LEVEQUE
System Engineer
SARL NET6D
bruno.leveque (AT) net6d (DOT) com
http://www.net6d.com


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)



Reply With Quote
  #3  
Old   
John K. Herreshoff
 
Posts: n/a

Default Re: Strange Insert Problem - 01-09-2004 , 05:34 AM



I'd hazard that you need ' around Anemone as in 'Anemone'.

HTH.

John.

On Friday 09 January 2004 05:25, Lola Lee wrote:
Quote:
I'm having a really strange insert problem, which I cannot figure out.

I have a table in my database, which I created using the following
query (I'm using Postgresql 7.4, if this helps):

CREATE TABLE yarncolor (
yarn_color_id SERIAL,
yarn_id int NULL,
yarn_color_nm varchar(35) NULL,
yarn_color_num varchar(10) NULL,
yarn_color_desc varchar(50) NULL,
discontinued_flg boolean NULL,
yarn_color_lud timestamp NULL,
PRIMARY KEY (yarn_color_id),
FOREIGN KEY (yarn_id)
REFERENCES yarn
);

Everytime I try to insert a record in this table via ColdFusion
generated page, I get this error message (I also get this in
phpPgMyAdmin):

SQL error:
ERROR: column "anemone" does not exist


In statement:
INSERT INTO YarnColortwo (yarn_id, yarn_color_nm, yarn_color_num,
yarn_color_desc, yarn_color_lud) VALUES ( 15, Anemone, 616, whatever,
now() )

I'm at a loss as to why does Postgresql think there is a column named
"anemone". Yes, I tried another string of character and get the same
message. Anyone have an idea what may be going on?

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)



Reply With Quote
  #4  
Old   
Lola Lee
 
Posts: n/a

Default Re: Strange Insert Problem - 01-09-2004 , 05:45 AM



At 11:38 AM +0100 1/9/04, Bruno LEVEQUE wrote:
Quote:
First, in insert, every strings must be quoted. Your query becomes :

INSERT INTO YarnColortwo (yarn_id, yarn_color_nm, yarn_color_num,
yarn_color_desc, yarn_color_lud) VALUES ( 15, 'Anemone', 616,
'whatever', now() ).

Works now - thanks!

--

Lola - mailto:lola (AT) his (DOT) com
http://www.lolajl.net | Blog at http://www.lolajl.net/blog/
Check out this blog: http://www.denbeste.nu
I'm in Bowie, MD, USA, halfway between DC and Annapolis.


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings



Reply With Quote
  #5  
Old   
Martin Atukunda
 
Posts: n/a

Default Re: Strange Insert Problem - 01-09-2004 , 05:59 AM



On Friday 09 January 2004 13:25, you wrote:
Quote:
I'm having a really strange insert problem, which I cannot figure out.

I have a table in my database, which I created using the following
query (I'm using Postgresql 7.4, if this helps):

CREATE TABLE yarncolor (
yarn_color_id SERIAL,
yarn_id int NULL,
yarn_color_nm varchar(35) NULL,
yarn_color_num varchar(10) NULL,
yarn_color_desc varchar(50) NULL,
discontinued_flg boolean NULL,
yarn_color_lud timestamp NULL,
PRIMARY KEY (yarn_color_id),
FOREIGN KEY (yarn_id)
REFERENCES yarn
);

Everytime I try to insert a record in this table via ColdFusion
generated page, I get this error message (I also get this in
phpPgMyAdmin):

SQL error:
ERROR: column "anemone" does not exist


In statement:
INSERT INTO YarnColortwo (yarn_id, yarn_color_nm, yarn_color_num,
yarn_color_desc, yarn_color_lud) VALUES ( 15, Anemone, 616, whatever,
now() )
I don't know how ColdFusion does it but, you should quote the strings that you
are inserting into the database i.e:

INSERT INTO YarnColortwo(
yarn_id,
yarn_color_nm,
yarn_color_num,
yarn_color_desc,
yarn_color_lud)
VALUES ( 15,
'Anemone',
'616',
'whatever',
now()
)

Quote:
I'm at a loss as to why does Postgresql think there is a column named
"anemone". Yes, I tried another string of character and get the same
message. Anyone have an idea what may be going on?
--
"If we don't succeed, we run the risk of failure."
--Bill Clinton, President

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.