473,609 Members | 1,851 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

syntax error but command executes anyway?

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.identif iers and original.identi fiers) have slightly different column
names.)

egenome_dev=# \!cat /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT INTO public.identifi ers (element_id, name, source, source_code, title)
SELECT DISTINCT
elementid,
name,
source,
sourcecode,
title
FROM original.identi fiers;
egenome_dev=# \i /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT 0 1672036
psql:/Users/murphy/cvs/egora/sql/data_port/port_identifier s.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.identi fiers
Table "original.ident ifiers"
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_el ementid_idx" btree (elementid)
"identifiers_na me_idx" btree (name)
"identifiers_na meid_idx" btree (nameid)
"identifiers_so urce_idx" btree (source)

egenome_dev=# select count(*) from original.identi fiers;
count
---------
1685440
(1 row)

egenome_dev=# \d identifiers
Table "public.identif iers"
Column | Type | Modifiers
-------------+-----------------------+-----------
element_id | integer |
name | character varying(80) |
source | character varying(39) |
source_code | character varying(2) |
title | text |
Indexes:
"identifiers_mu lti1_idx" btree (name, source)
"identifiers_na me_idx" btree (name)

[NOTE: the above indexes on original.identi fiers 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/egora/sql/data_port/port_identifier s.sql
INSERT INTO public.identifi ers (element_id, name, source, source_code, title)
SELECT DISTINCT
elementid,
name,
source,
sourcecode,
title
FROM original.identi fiers;

egenome_dev=# \i /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT 0 1672036
psql:/Users/murphy/cvs/egora/sql/data_port/port_identifier s.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

Nov 23 '05 #1
8 2212
On Sat, 2004-06-19 at 07:14, Kevin Murphy wrote:
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.
It's not actually inserting anything...
(Don't be confused by the fact that the two tables referred to
(public.identif iers and original.identi fiers) have slightly different column
names.)

egenome_dev=# \!cat /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT INTO public.identifi ers (element_id, name, source, source_code, title)
SELECT DISTINCT
elementid,
name,
source,
sourcecode,
title
FROM original.identi fiers;
egenome_dev=# \i /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT 0 1672036


This INSERT 0 part tells you it didn't actually insert anything.
Since I don't see any obvious error, I'm wondering if maybe there are
characters in the sql file that don't print that are causing this
problem. Try recreating the SQL by hand and see if you get the same
problem. Use the simplest editor on your system, like vi or notepad or
whatever.

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

Nov 23 '05 #2
On Sat, 2004-06-19 at 07:14, Kevin Murphy wrote:
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.
It's not actually inserting anything...
(Don't be confused by the fact that the two tables referred to
(public.identif iers and original.identi fiers) have slightly different column
names.)

egenome_dev=# \!cat /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT INTO public.identifi ers (element_id, name, source, source_code, title)
SELECT DISTINCT
elementid,
name,
source,
sourcecode,
title
FROM original.identi fiers;
egenome_dev=# \i /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT 0 1672036


This INSERT 0 part tells you it didn't actually insert anything.
Since I don't see any obvious error, I'm wondering if maybe there are
characters in the sql file that don't print that are causing this
problem. Try recreating the SQL by hand and see if you get the same
problem. Use the simplest editor on your system, like vi or notepad or
whatever.

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

Nov 23 '05 #3
Kevin Murphy <mu****@genome. chop.edu> writes:
What should I make of this? egenome_dev=# \!cat /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT INTO public.identifi ers (element_id, name, source, source_code, title)
SELECT DISTINCT
elementid,
name,
source,
sourcecode,
title
FROM original.identi fiers; egenome_dev=# \i /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT 0 1672036
psql:/Users/murphy/cvs/egora/sql/data_port/port_identifier s.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_identifier s.sql 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

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

Nov 23 '05 #4
Kevin Murphy <mu****@genome. chop.edu> writes:
What should I make of this? egenome_dev=# \!cat /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT INTO public.identifi ers (element_id, name, source, source_code, title)
SELECT DISTINCT
elementid,
name,
source,
sourcecode,
title
FROM original.identi fiers; egenome_dev=# \i /Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql
INSERT 0 1672036
psql:/Users/murphy/cvs/egora/sql/data_port/port_identifier s.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_identifier s.sql 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

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

Nov 23 '05 #5
Scott,
egenome_dev=# \i
/Users/murphy/cvs/egora/sql/data_port/port_identifier s.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.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #6
Scott,
egenome_dev=# \i
/Users/murphy/cvs/egora/sql/data_port/port_identifier s.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.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #7
On Saturday 19 June 2004 06:57 pm, Tom Lane wrote:
egenome_dev=# \i
/Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql INSERT 0
1672036
psql:/Users/murphy/cvs/egora/sql/data_port/port_identifier s.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_identifier s.sql 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 ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #8
On Saturday 19 June 2004 06:57 pm, Tom Lane wrote:
egenome_dev=# \i
/Users/murphy/cvs/egora/sql/data_port/port_identifier s.sql INSERT 0
1672036
psql:/Users/murphy/cvs/egora/sql/data_port/port_identifier s.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_identifier s.sql 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 ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
1854
by: middletree | last post by:
I've seen posts here and elsewhere which read something along the lines of "PULLNG MY HAIR OUT!!!!!" or "HELLLLPPP!". Well, I know that kind of subject line isn't descriptive, but I sure can relate right now. I've been struggling for days--days!!-- on this one simple query. I really need to get past this thing and move on. Please help. I have a classic ASP page, and it gives you 4 dropdowns. You can select any or none of them....
2
6667
by: micahstrasser | last post by:
I have been trying for days to send a command to the command prompt through the shell() function in vb.net. For some reason it is not working. Here is the code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim command As String command = "systeminfo > C:\temp\sysinfo.txt"
0
323
by: Kevin Murphy | last post by:
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.identifiers) have slightly different column names.) egenome_dev=# \!cat /Users/murphy/cvs/egora/sql/data_port/port_identifiers.sql INSERT INTO public.identifiers (element_id, name, source,...
10
19142
by: Jim Underwood | last post by:
I am having a problem with my web page timng out while retrieving a long runnign report (90-120 seconds. I have tried modifying several settings in various places and cannot get it to run for more than 90 seconds. I am running VS.Net and the app is ASP.Net, written using VB.Net. The app calls an asp.Net web service to retrieve the report. Both the web site and the web service are running locally on my PC. I have tried modifying the...
7
2500
by: James | last post by:
Wrong syntax is shown below. What should be the delimiter before else? python -c 'if 1==1: print "yes"; else print "no"' James
669
25804
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
1
1784
by: PI | last post by:
Hi guys, I need some urgent help here please: I am using an include_once() command to include a file that sits a level above the file view.php. when the code is run, I have an error as follows: Warning: include_once(../common.php) : failed to open stream: No such file or directory in C:\Program Files\.. \view.php on line 2 Warning: include_once() : Failed opening '../
7
2876
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM", "OE_HDR"."SLS_MAN_NO", "OE_HDR"."SLS_MAN_INITIALS", "OE_HDR"."ORD_DAT", "OE_HDR"."SHIP_DAT" FROM "OE_HDR" WHERE ("OE_HDR"."ORD_NO"='174310') I also have DropDownList1 working properly. For the WHERE portion of
7
18661
by: HSXWillH | last post by:
I have a field in a database that contains last names. In some of those names, like O'Brien and O'Connor, there is a ' symbol. I am using combo boxes on a form to build a form filter and in particular, I receive a Runtime 3075 Syntax Error : Missing Operator in query expression '( Like '*Jim O'Toole*')' and I know it stems from the apostrophe in the name box, but I don't know how to fix it. The combo box that contains the list of names...
0
8139
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8579
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8555
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8408
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7024
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6064
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5524
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4032
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.