Обсуждение: Running psql in emacs shell generates key conflict error: why?

Поиск
Список
Период
Сортировка

Running psql in emacs shell generates key conflict error: why?

От
Rich Shepard
Дата:
An unexpected result this morning that I'd like to understand. In emacs I
loaded the file organizations.sql in a buffer to insert new rows in that
table. Rather than running psql from a virtual console, I opened an emacs
shell and entered the command,
   psql -f organizations.sql -d bustrac
and saw an error that the last line in the .sql file was in conflict with an
existing primary key. (I let postgres assign the keys when new rows are
inserted.)

Checking the table for that primary key confirmed that it was a different
organization so there should not have been a conflict.

Using a virtual console, and in the directory with the scripts, I ran the
same psql command and it completed as expected.

I don't think this is a emacs error because the shell opens in the same
directory as the script I'm running.

Why might postgres fail to run the script within an emacs shell while having
no issues running the same script from a virtual console?

A curious mind wants to learn.

TIA,

Rich



Re: Running psql in emacs shell generates key conflict error: why?

От
Adrian Klaver
Дата:
On 4/2/19 8:00 AM, Rich Shepard wrote:
> An unexpected result this morning that I'd like to understand. In emacs I
> loaded the file organizations.sql in a buffer to insert new rows in that
> table. Rather than running psql from a virtual console, I opened an emacs
> shell and entered the command,
>    psql -f organizations.sql -d bustrac
> and saw an error that the last line in the .sql file was in conflict 
> with an
> existing primary key. (I let postgres assign the keys when new rows are
> inserted.)

What was the exact message?

What was in the last line?

> 
> Checking the table for that primary key confirmed that it was a different
> organization so there should not have been a conflict.
> 
> Using a virtual console, and in the directory with the scripts, I ran the
> same psql command and it completed as expected.
> 
> I don't think this is a emacs error because the shell opens in the same
> directory as the script I'm running.
> 
> Why might postgres fail to run the script within an emacs shell while 
> having
> no issues running the same script from a virtual console?

Difference in shell escaping?


> 
> A curious mind wants to learn.
> 
> TIA,
> 
> Rich
> 
> 
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com



Re: Running psql in emacs shell generates key conflict error: why?[FIXED]

От
Rich Shepard
Дата:
On Tue, 2 Apr 2019, Adrian Klaver wrote:

> What was the exact message?
> What was in the last line?
> Difference in shell escaping?

Adrian,

Cannot answer the first two because that work is long gone. So, I just tried
it again with only one row to insert and psql inserted that row without
complaint.

Let's consider it a fluke unless it happens again.

Regards,

Rich