Fresh eyeballs needed: input into error

Started by Rich Shepardalmost 4 years ago20 messagesgeneral
Jump to latest
#1Rich Shepard
rshepard@appl-ecosys.com

I'm getting a syntax error with an input into statement and I cannot see the
cause.

A MWE and the result (N.B.: line one wrapped for readability; it ends with
'values'):
insert into people (person_nbr,lname,fname,job_title,company_nbr,loc_nbr,
loc_phone_ext,direct_phone,direct_fax,cell_phone,email,active,comment) values
(6000,'No','Name',null,404,1,null,null,null,null,null,null,null);

2: ERROR: syntax error at end of input
LINE 2: (
^
What do I keep missing?

TIA,

Rich

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Rich Shepard (#1)
Re: Fresh eyeballs needed: input into error

On 4/26/22 2:31 PM, Rich Shepard wrote:

I'm getting a syntax error with an input into statement and I cannot see
the
cause.

A MWE and the result (N.B.: line one wrapped for readability; it ends with
'values'):
insert into people (person_nbr,lname,fname,job_title,company_nbr,loc_nbr,
loc_phone_ext,direct_phone,direct_fax,cell_phone,email,active,comment)
values (6000,'No','Name',null,404,1,null,null,null,null,null,null,null);

2: ERROR:  syntax error at end of input
LINE 2: (
         ^
What do I keep missing?

I'm guessing some sort of hidden character.

What client are you using to run this?

Where is the query string coming from?

TIA,

Rich

--
Adrian Klaver
adrian.klaver@aklaver.com

#3Rich Shepard
rshepard@appl-ecosys.com
In reply to: Adrian Klaver (#2)
Re: Fresh eyeballs needed: input into error

On Tue, 26 Apr 2022, Adrian Klaver wrote:

I'm guessing some sort of hidden character.

Adrian,

The 'insert into ...' string is a template I've been using for years. It's
worked earlier today, too.

What client are you using to run this?

psql in a linux virtual terminal.

Where is the query string coming from?

I type each row to add to the table by hand.

Rich

#4Rich Shepard
rshepard@appl-ecosys.com
In reply to: Adrian Klaver (#2)
Re: Fresh eyeballs needed: input into error

On Tue, 26 Apr 2022, Adrian Klaver wrote:

I'm guessing some sort of hidden character.

Adrian,

Oh, ... forgot to mention in my response that the MWE values were added to
the template in emacs while I get the same error using psql -d <database> -f
<filename> in a v.t. or entering 'insert into people values (...)' within
the psql shell.

All throw the same error.

Rich

#5David G. Johnston
david.g.johnston@gmail.com
In reply to: Rich Shepard (#4)
Re: Fresh eyeballs needed: input into error

On Tue, Apr 26, 2022 at 2:54 PM Rich Shepard <rshepard@appl-ecosys.com>
wrote:

On Tue, 26 Apr 2022, Adrian Klaver wrote:

I'm guessing some sort of hidden character.

Adrian,

Oh, ... forgot to mention in my response that the MWE values were added to
the template in emacs while I get the same error using psql -d <database>
-f
<filename> in a v.t. or entering 'insert into people values (...)' within
the psql shell.

All throw the same error.

What version of PostgreSQL?

Testing on HEAD (and by inspection) nothing you've shown us provokes a
syntax error in PostgreSQL.

regression=> insert into people
(person_nbr,lname,fname,job_title,company_nbr,loc_nbr,
regression(>
loc_phone_ext,direct_phone,direct_fax,cell_phone,email,active,comment)
values
regression->
(6000,'No','Name',null,404,1,null,null,null,null,null,null,null);
ERROR: relation "people" does not exist
LINE 1: insert into people (person_nbr,lname,fname,job_title,company...

No syntax error, that it didn't find the table is expected.

Copied and pasted right from your email.

David J.

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rich Shepard (#1)
Re: Fresh eyeballs needed: input into error

Rich Shepard <rshepard@appl-ecosys.com> writes:

I'm getting a syntax error with an input into statement and I cannot see the
cause.

A MWE and the result (N.B.: line one wrapped for readability; it ends with
'values'):
insert into people (person_nbr,lname,fname,job_title,company_nbr,loc_nbr,
loc_phone_ext,direct_phone,direct_fax,cell_phone,email,active,comment) values
(6000,'No','Name',null,404,1,null,null,null,null,null,null,null);

2: ERROR: syntax error at end of input
LINE 2: (
^
What do I keep missing?

Copying-and-pasting from your mail gets me

ERROR: relation "people" does not exist
LINE 1: insert into people (person_nbr,lname,fname,job_title,company...
^

so there's nothing wrong with the syntax as-presented. I agree with
Adrian's guess about invisible characters in your input file;
perhaps a control-D or ASCII NUL would produce that symptom.

regards, tom lane

#7Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Rich Shepard (#4)
Re: Fresh eyeballs needed: input into error

On 4/26/22 2:53 PM, Rich Shepard wrote:

On Tue, 26 Apr 2022, Adrian Klaver wrote:

I'm guessing some sort of hidden character.

Adrian,

Oh, ... forgot to mention in my response that the MWE values were added to
the template in emacs while I get the same error using psql -d
<database> -f
<filename> in a v.t. or entering 'insert into people values (...)' within
the psql shell.

All throw the same error.

I cannot replicate. You are going to have to scan the string on your
end, I am still guessing an odd character.

Rich

--
Adrian Klaver
adrian.klaver@aklaver.com

#8Rich Shepard
rshepard@appl-ecosys.com
In reply to: David G. Johnston (#5)
Re: Fresh eyeballs needed: input into error

On Tue, 26 Apr 2022, David G. Johnston wrote:

What version of PostgreSQL?

David,

12.7

Testing on HEAD (and by inspection) nothing you've shown us provokes a
syntax error in PostgreSQL.

regression=> insert into people
(person_nbr,lname,fname,job_title,company_nbr,loc_nbr,
regression(>
loc_phone_ext,direct_phone,direct_fax,cell_phone,email,active,comment)
values
regression->
(6000,'No','Name',null,404,1,null,null,null,null,null,null,null);
ERROR: relation "people" does not exist
LINE 1: insert into people (person_nbr,lname,fname,job_title,company...

No syntax error, that it didn't find the table is expected.

Well, as I wrote, that syntax has worked for years, including earlier this
morning. Perhaps it will work again tomorrow when I log back in to the
workstation.

Thanks,

Rich

#9Rich Shepard
rshepard@appl-ecosys.com
In reply to: Tom Lane (#6)
Re: Fresh eyeballs needed: input into error

On Tue, 26 Apr 2022, Tom Lane wrote:

so there's nothing wrong with the syntax as-presented. I agree with
Adrian's guess about invisible characters in your input file; perhaps a
control-D or ASCII NUL would produce that symptom.

tom,

It's probably a transient glitch that will go away after I log out.

Thanks,

Rich

#10Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Rich Shepard (#8)
Re: Fresh eyeballs needed: input into error

On 4/26/22 3:08 PM, Rich Shepard wrote:

On Tue, 26 Apr 2022, David G. Johnston wrote:

What version of PostgreSQL?

David,

12.7

Testing on HEAD (and by inspection) nothing you've shown us provokes a
syntax error in PostgreSQL.

regression=> insert into people
(person_nbr,lname,fname,job_title,company_nbr,loc_nbr,
regression(>
loc_phone_ext,direct_phone,direct_fax,cell_phone,email,active,comment)
values
regression->
(6000,'No','Name',null,404,1,null,null,null,null,null,null,null);
ERROR:  relation "people" does not exist
LINE 1: insert into people (person_nbr,lname,fname,job_title,company...

No syntax error, that it didn't find the table is expected.

Well, as I wrote, that syntax has worked for years, including earlier this
morning. Perhaps it will work again tomorrow when I log back in to the
workstation.

It is not the syntax, somewhere since this morning you introduced a
hidden character into the string.

Thanks,

Rich

--
Adrian Klaver
adrian.klaver@aklaver.com

#11Rich Shepard
rshepard@appl-ecosys.com
In reply to: Rich Shepard (#9)
Re: Fresh eyeballs needed: input into error [FIXED]

On Tue, 26 Apr 2022, Rich Shepard wrote:

It's probably a transient glitch that will go away after I log out.

Yep. I logged out and back in just now. The insert script worked as it
always had before and both rows were added to the table.

I've seen these sort of hang-ups before and didn't want to log out, back
in, and recreate the working environment. Had I done so I'd have saved a lot
of time.

Thanks for your inputs, everyone,

Rich

#12Bruce Momjian
bruce@momjian.us
In reply to: Rich Shepard (#11)
Re: Fresh eyeballs needed: input into error [FIXED]

On Tue, Apr 26, 2022 at 06:09:42PM -0700, Rich Shepard wrote:

On Tue, 26 Apr 2022, Rich Shepard wrote:

It's probably a transient glitch that will go away after I log out.

Yep. I logged out and back in just now. The insert script worked as it
always had before and both rows were added to the table.

I've seen these sort of hang-ups before and didn't want to log out, back
in, and recreate the working environment. Had I done so I'd have saved a lot
of time.

Thanks for your inputs, everyone,

I am curious what OS psql was using that was fixed by a re-login?

--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com

Indecision is a decision. Inaction is an action. Mark Batterson

#13Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Bruce Momjian (#12)
Re: Fresh eyeballs needed: input into error [FIXED]

On 4/26/22 20:11, Bruce Momjian wrote:

On Tue, Apr 26, 2022 at 06:09:42PM -0700, Rich Shepard wrote:

On Tue, 26 Apr 2022, Rich Shepard wrote:

I am curious what OS psql was using that was fixed by a re-login?

Rich uses Slackware.

--
Adrian Klaver
adrian.klaver@aklaver.com

#14Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Rich Shepard (#1)
Re: Fresh eyeballs needed: input into error

On Tue, 2022-04-26 at 14:31 -0700, Rich Shepard wrote:

I'm getting a syntax error with an input into statement and I cannot see the
cause.

A MWE and the result (N.B.: line one wrapped for readability; it ends with
'values'):
insert into people (person_nbr,lname,fname,job_title,company_nbr,loc_nbr,
loc_phone_ext,direct_phone,direct_fax,cell_phone,email,active,comment) values
(6000,'No','Name',null,404,1,null,null,null,null,null,null,null);

2: ERROR:  syntax error at end of input
LINE 2: (
          ^
What do I keep missing?

Another explanation is that there was already something in your query buffer
when you entered that statement, so that together it caused a syntactically
incorrect statement, something like (in psql):

test=> insert
test-> insert into people (person_nbr,lname,fname,job_title,company_nbr,loc_nbr,
loc_phone_ext,direct_phone,direct_fax,cell_phone,email,active,comment) values
(6000,'No','Name',null,404,1,null,null,null,null,null,null,null);
ERROR: syntax error at or near "insert"
LINE 2: insert into people (person_nbr,lname,fname,job_title,company...
^

Yours,
Laurenz Albe

#15Rich Shepard
rshepard@appl-ecosys.com
In reply to: Bruce Momjian (#12)
Re: Fresh eyeballs needed: input into error [FIXED]

On Tue, 26 Apr 2022, Bruce Momjian wrote:

I am curious what OS psql was using that was fixed by a re-login?

Bruce,

This desktop's running Slackware64-14.2.

Regards,

Rich

#16Rich Shepard
rshepard@appl-ecosys.com
In reply to: Laurenz Albe (#14)
Re: Fresh eyeballs needed: input into error

On Wed, 27 Apr 2022, Laurenz Albe wrote:

test=> insert
test-> insert into people (person_nbr,lname,fname,job_title,company_nbr,loc_nbr,
loc_phone_ext,direct_phone,direct_fax,cell_phone,email,active,comment) values
(6000,'No','Name',null,404,1,null,null,null,null,null,null,null);
ERROR: syntax error at or near "insert"
LINE 2: insert into people (person_nbr,lname,fname,job_title,company...
^

Laurenz,

From time to time I mis-type a character or make another error and psql
responds with a different prompt and no explicit explanation. I'll then type
C-c and get the default => prompt back. Your example is appreciated and may
very well have been the cause, but I kept trying at the default prompt.

I'll re-read the psql man page to better understand the different prompts.

Thank you,

Rich

#17Rob Sargent
robjsargent@gmail.com
In reply to: Rich Shepard (#16)
Re: Fresh eyeballs needed: input into error

On Apr 27, 2022, at 5:43 AM, Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Wed, 27 Apr 2022, Laurenz Albe wrote:

From time to time I mis-type a character or make another error and psql
responds with a different prompt and no explicit explanation. I'll then type
C-c and get the default => prompt back. Your example is appreciated and may
very well have been the cause, but I kept trying at the default prompt.

I'll re-read the psql man page to better understand the different prompts.

Thank you,

Rich

Have you tried \r instead of C-c?

Show quoted text
#18Rich Shepard
rshepard@appl-ecosys.com
In reply to: Rob Sargent (#17)
Re: Fresh eyeballs needed: input into error

On Wed, 27 Apr 2022, Rob Sargent wrote:

Have you tried \r instead of C-c?

Rob,

No, I haven't. I'll try it to reset the query buffer the next time I make a
mistake entering a command.

Thanks,

Rich

#19Francisco Olarte
folarte@peoplecall.com
In reply to: Rich Shepard (#15)
Re: Fresh eyeballs needed: input into error [FIXED]

Rich:

On Wed, 27 Apr 2022 at 14:38, Rich Shepard <rshepard@appl-ecosys.com> wrote:

On Tue, 26 Apr 2022, Bruce Momjian wrote:

I am curious what OS psql was using that was fixed by a re-login?

This desktop's running Slackware64-14.2.

Where you using cut&paste / selection or something similar? Lately
I've been getting weird errors on paste operations due to bracketed
paste, which are puzzling, It seems to have interactions with readline
and other stuff depending on where the cursor is and some other
things. Last I remembered when pasting some things to guile invisible
chars ( paste brackets ) where intercepted by its REPL leading to
bizarre errors. And sometimes after a relogin things are done a bit
different and make problem disappear.

Francisco Olarte.

#20Rich Shepard
rshepard@appl-ecosys.com
In reply to: Francisco Olarte (#19)
Re: Fresh eyeballs needed: input into error [FIXED]

On Wed, 27 Apr 2022, Francisco Olarte wrote:

Where you using cut&paste / selection or something similar? Lately I've
been getting weird errors on paste operations due to bracketed paste,
which are puzzling, It seems to have interactions with readline and other
stuff depending on where the cursor is and some other things. Last I
remembered when pasting some things to guile invisible chars ( paste
brackets ) where intercepted by its REPL leading to bizarre errors. And
sometimes after a relogin things are done a bit different and make problem
disappear.

Francisco,

Yes. I often use the trackball to highlight plain ASCII text, including the
enclosing '...', and paste it to the psql shell command line. Most of the
time it works. When psql presents prompt 2 instead of command success I
re-enter by re-keyboarding. That usually clears up the issue.

Thanks,

Rich