Can I change the background of the blog?
syntax error but command executes anyway?
Hello Guest
  
  • Login
• Register…
• Start blog
  • Who, Where, When
• What is interesting here?
• Duels
  • Polls
• Avatars
• Interests
  • Cities and Countries
• Random blog
• Users search
  • Search
• Games
• Tests
• QAIX
  • Сообщества
• Talxy Chat
• Horoscope
• Online
 
Register!

QAIX > PostgreSQL database development > syntax error but command executes anyway? 20 June 2004 02:34:36

  Top users: 
  Recent blog posts: 
  They have birthday today: 
  Forums:   
  Discuss: 
  Recent forum topics: 
  Recent forum comments:
  Модератор:

syntax error but command executes anyway?

Kevin Murphy 19 June 2004 16:14:19
 Using PG 7.4.3 on Mac OS X 10.2.8, the following "insert into ... select ..."
statement completed and then announced a syntax error, which seems bizarre.

(Don't be confused by the fact that the two tables referred to
(public.identifiers­ and original.identifier­s) have slightly different column
names.)

egenome_dev=# \!cat /Users/murphy/cvs/e­gora/sql/data_port/p­ort_identifiers.sql
INSERT INTO public.identifiers (element_id, name, source, source_code, title)
SELECT DISTINCT
elementid,
name,
source,
sourcecode,
title
FROM original.identifier­s;
egenome_dev=# \i /Users/murphy/cvs/e­gora/sql/data_port/p­ort_identifiers.sql
INSERT 0 1672036
psql:/Users/murphy/­cvs/egora/sql/data_p­ort/port_identifiers­.sql:15: ERROR:
syntax error at or near "sourcecode" at character 2

A fuller psql transcript showing table layouts is below.

What should I make of this?

Thanks,
Kevin Murphy

P.S. Full transcript:

egenome_dev=# \d original.identifier­s
Table "original.identifie­rs"
Column | Type | Modifiers
------------+------­-----------------+--­---------
elementid | integer |
nameid | character varying(80) |
name | character varying(80) |
source | character varying(39) |
title | text |
sourcecode | character varying(2) |
Indexes:
"identifiers_elemen­tid_idx" btree (elementid)
"identifiers_name_i­dx" btree (name)
"identifiers_nameid­_idx" btree (nameid)
"identifiers_source­_idx" btree (source)

egenome_dev=# select count(*) from original.identifier­s;
count
---------
1685440
(1 row)

egenome_dev=# \d identifiers
Table "public.identifiers­"
Column | Type | Modifiers
-------------+-----­------------------+-­----------
element_id | integer |
name | character varying(80) |
source | character varying(39) |
source_code | character varying(2) |
title | text |
Indexes:
"identifiers_multi1­_idx" btree (name, source)
"identifiers_name_i­dx" btree (name)

[NOTE: the above indexes on original.identifiers are not the intended final
indexes; in fact, I had forgotten that they were there.]

egenome_dev=# truncate identifiers;
TRUNCATE TABLE

egenome_dev=# \!cat /Users/murphy/cvs/e­gora/sql/data_port/p­ort_identifiers.sql
INSERT INTO public.identifiers (element_id, name, source, source_code, title)
SELECT DISTINCT
elementid,
name,
source,
sourcecode,
title
FROM original.identifier­s;

egenome_dev=# \i /Users/murphy/cvs/e­gora/sql/data_port/p­ort_identifiers.sql
INSERT 0 1672036
psql:/Users/murphy/­cvs/egora/sql/data_p­ort/port_identifiers­.sql:15: ERROR:
syntax error at or near "sourcecode" at character 2

egenome_dev=# select count(*) from identifiers;
count
---------
1672036
(1 row)

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

Add comment
Kevin Murphy 20 June 2004 02:06:06 permanent link ]
 Scott,
egenome_dev=# \i> > /Users/murphy/cvs/e­gora/sql/data_port/p­ort_identifiers.sql > > INSERT 0 1672036>
This INSERT 0 part tells you it didn't actually insert anything.

Actually, that's not true. I didn't know what this number was until just now,
but I looked it up: for a single-row insert, it's the OID of the new row;
otherwise, it's 0. The 1672036, on the other hand, means that 1,672,036 rows
were inserted.

-Kevin Murphy

-------------------­--------(end of broadcast)---------­------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgres­ql.org/docs/faqs/FAQ­.html

Add comment
Kevin Murphy 20 June 2004 02:34:36 permanent link ]
 On Saturday 19 June 2004 06:57 pm, Tom Lane wrote:> > egenome_dev=# \i> > /Users/murphy/cvs/e­gora/sql/data_port/p­ort_identifiers.sql INSERT 0> > 1672036> > psql:/Users/murphy/­cvs/egora/sql/data_p­ort/port_identifiers­.sql:15:> > ERROR: syntax error at or near "sourcecode" at character 2>
It seems mighty suspicious that psql is reporting a syntax error at line> 15 of the file when cat is only showing 9 lines. I suspect that the> insert you are showing us did execute, but then something further on> in the file is producing the syntax error.>
I am wondering whether cat on OS X stops at embedded nulls, or something> stupid like that. It sure looks like there must be garbage in the> port_identifiers.sq­l file beyond what cat has printed here. What do you> see when you examine the file with other tools? (Try "od -c" if nothing> else springs to mind.)>
It is possible that the problem is not entirely cat's fault but has> something to do with the way that psql's \! command invokes cat.> Does cat at the shell prompt produce the same output?>
regards, tom lane

It is indeed very weird, since the script is not that long. I piped it
through 'od -a' to confirm.

However, I retract my complaint, since I can't reproduce it!

I had to take a bad DIMM out of this machine a few days ago; maybe I need to
run that memory test again. Still, it would seem remarkable if a memory
error could produce my initial results rather than a crash or hang. I am
also feeling like compiling PG again, since it was initially compiled with
that bad DIMM (but again, what would the odds be?)

Tom, as always, thanks for your mellow and rapid response to questions.

I'll let you know if this crops up again in a reproducible way.

-Kevin Murphy

-------------------­--------(end of broadcast)---------­------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresq­l.org so that your
message can get through to the mailing list cleanly

Add comment
 

Add new comment

As:
Login:  Password:  
 
 
  
 
Пожалуйста, относитесь к собеседникам уважительно, не используйте нецензурные слова, не злоупотребляйте заглавными буквами, не публикуйте рекламу и объявления о купле/продаже, а также материалы нарушающие сетевой этикет или законы РФ. Ваш ip-адрес записывается.


QAIX > PostgreSQL database development > syntax error but command executes anyway? 20 June 2004 02:34:36

see also:
[Management, JMX/JBoss] - How to create…
[Security & JAAS/JBoss] - Security…
[Connectors and JCA/JBoss] - Re…
pass tests:
You and sex.
see also:
How to sync transfer iphone ringtone on…
How to break the itunes ringtone 30s…
How to break the itunes ringtone 30s…

  Copyright © 2001—2010 QAIX
Идея: Монашёв Михаил.
Авторами текстов, изображений и видео, размещённых на этой странице, являются пользователи сайта.
See Help and FAQ in the community support.qaix.com.
Write in the community about the bugs you have noticedbugs.qaix.com.
Write your offers and comments in the communities suggest.qaix.com.
Information for parents.
Пишите нам на .
If you would like to report an abuse of our service, such as a spam message, please .
Если Вы хотите пожаловаться на содержимое этой страницы, пожалуйста .