Thread: Commands history with psql in a Windows command line shell

Commands history with psql in a Windows command line shell

From
Lmhelp1
Date:
Hello,

I am using "psql" in "cmd.exe" in Windows (8.1).

Below is the command I use to connect to a database with "psql":
cmd.exe> psql -p <tcp_port> -U <username> <database_name>

My problem is the following.
Suppose I enter one command:
<database_name># SELECT * FROM <a_table_1>;
and then another one:
<database_name># SELECT * FROM <a_table_2>;
The commands history "is not working": meaning I cannot retrieve these
last two commands I entered by hitting the top arrow key.
Instead, I have to type them again.

To try to solve the problem, I entered the command:
<database_name># \set HISTSIZE 100
but it didn't change anything.

Yesterday, I don't remember what I did, but I could access the commands
history using Powershell, maybe the command "\set HISTSIZE 100" and
maybe a "psqlrc" file.
But whatever I've been trying to do since, I can't make it work again.

Can you please advise me what to do to make this work?

Best regards.
--
Léa Massiot



Re: Commands history with psql in a Windows command line shell

From
Melvin Davidson
Date:
Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide us with a little more useful information like current PostgreSQL version and O/S?
Otherwise we have absolutely no idea what the problem might be.

On Tue, Aug 2, 2016 at 11:18 AM, Lmhelp1 <lmhelp1@orange.fr> wrote:
Hello,

I am using "psql" in "cmd.exe" in Windows (8.1).

Below is the command I use to connect to a database with "psql":
cmd.exe> psql -p <tcp_port> -U <username> <database_name>

My problem is the following.
Suppose I enter one command:
<database_name># SELECT * FROM <a_table_1>;
and then another one:
<database_name># SELECT * FROM <a_table_2>;
The commands history "is not working": meaning I cannot retrieve these last two commands I entered by hitting the top arrow key.
Instead, I have to type them again.

To try to solve the problem, I entered the command:
<database_name># \set HISTSIZE 100
but it didn't change anything.

Yesterday, I don't remember what I did, but I could access the commands history using Powershell, maybe the command "\set HISTSIZE 100" and maybe a "psqlrc" file.
But whatever I've been trying to do since, I can't make it work again.

Can you please advise me what to do to make this work?

Best regards.
--
Léa Massiot



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: Commands history with psql in a Windows command line shell

From
Lmhelp1
Date:

Thank you for your answer.

cmd.exe> psql --version
psql (PostgreSQL) 9.5.2

Like I wrote, the Windows OS is 8.1 Pro.

Best regards,
--
Léa Massiot


On 2016-08-02 5:31 PM, Melvin Davidson wrote:
Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide us with a little more useful information like current PostgreSQL version and O/S?
Otherwise we have absolutely no idea what the problem might be.

On Tue, Aug 2, 2016 at 11:18 AM, Lmhelp1 <lmhelp1@orange.fr> wrote:
Hello,

I am using "psql" in "cmd.exe" in Windows (8.1).

Below is the command I use to connect to a database with "psql":
cmd.exe> psql -p <tcp_port> -U <username> <database_name>

My problem is the following.
Suppose I enter one command:
<database_name># SELECT * FROM <a_table_1>;
and then another one:
<database_name># SELECT * FROM <a_table_2>;
The commands history "is not working": meaning I cannot retrieve these last two commands I entered by hitting the top arrow key.
Instead, I have to type them again.

To try to solve the problem, I entered the command:
<database_name># \set HISTSIZE 100
but it didn't change anything.

Yesterday, I don't remember what I did, but I could access the commands history using Powershell, maybe the command "\set HISTSIZE 100" and maybe a "psqlrc" file.
But whatever I've been trying to do since, I can't make it work again.

Can you please advise me what to do to make this work?

Best regards.
--
Léa Massiot



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.


Re: Commands history with psql in a Windows command line shell

From
"David G. Johnston"
Date:
On Tue, Aug 2, 2016 at 11:31 AM, Melvin Davidson <melvin6925@gmail.com> wrote:
Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide us with a little more useful information like current PostgreSQL version and O/S?
Otherwise we have absolutely no idea what the problem might be.


"Windows (8.1)" refers to the O/S version.

Knowing the PostgreSQL version probably won't make a difference though knowing how it was installed might (though not for me personally).

David J.

Re: Commands history with psql in a Windows command line shell

From
Melvin Davidson
Date:


On Tue, Aug 2, 2016 at 11:40 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Tue, Aug 2, 2016 at 11:31 AM, Melvin Davidson <melvin6925@gmail.com> wrote:
Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide us with a little more useful information like current PostgreSQL version and O/S?
Otherwise we have absolutely no idea what the problem might be.


"Windows (8.1)" refers to the O/S version.

Knowing the PostgreSQL version probably won't make a difference though knowing how it was installed might (though not for me personally).

David J.


Thank you, Based on
https://www.postgresql.org/docs/9.5/static/app-psql.html#APP-PSQL-ENVIRONMENT

The following may be pertinent.

If -n / --no-readline was specified, then command history is not used.

What happens if you issue the \s command in psql? Is history supported?

What is the value for HISTFILE?







--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

Re: Commands history with psql in a Windows command line shell

From
Lmhelp1
Date:

Thank you for your answer.

1.
Like I wrote in my first post, the command I use to launch "psql" is:
cmd.exe> psql -p <tcp_port> -U <username> <database_name>
So, I do not specify the "--no-readline" option.

2.
cmd.exe psql <database_name># \s
history is not supported by this installation

Powershell psql <database_name># \s
history is not supported by this installation

To install PostgreSQL, I used the "postgresql-9.5.2-1-windows-x64.exe" installer the 2016/04/21.
So I don't remember much about what I did that day.

3.
When I do:

psql <database_name># \set
HISTFILE does not appear in the result.
So, I guess it is not set.

Best regards,
--
Léa Massiot


On 2016-08-02 5:56 PM, Melvin Davidson wrote:

The following may be pertinent.

If -n / --no-readline was specified, then command history is not used.

What happens if you issue the \s command in psql? Is history supported?

What is the value for HISTFILE?

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.


On Tue, Aug 2, 2016 at 11:40 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Tue, Aug 2, 2016 at 11:31 AM, Melvin Davidson <melvin6925@gmail.com> wrote:
Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide us with a little more useful information like current PostgreSQL version and O/S?
Otherwise we have absolutely no idea what the problem might be.


"Windows (8.1)" refers to the O/S version.

Knowing the PostgreSQL version probably won't make a difference though knowing how it was installed might (though not for me personally).

David J.



On 2016-08-02 5:40 PM, Lmhelp1 wrote:

Thank you for your answer.

cmd.exe> psql --version
psql (PostgreSQL) 9.5.2

Like I wrote, the Windows OS is 8.1 Pro.

Best regards,
--
Léa Massiot


On 2016-08-02 5:31 PM, Melvin Davidson wrote:
Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide us with a little more useful information like current PostgreSQL version and O/S?
Otherwise we have absolutely no idea what the problem might be.

On Tue, Aug 2, 2016 at 11:18 AM, Lmhelp1 <lmhelp1@orange.fr> wrote:
Hello,

I am using "psql" in "cmd.exe" in Windows (8.1).

Below is the command I use to connect to a database with "psql":
cmd.exe> psql -p <tcp_port> -U <username> <database_name>

My problem is the following.
Suppose I enter one command:
<database_name># SELECT * FROM <a_table_1>;
and then another one:
<database_name># SELECT * FROM <a_table_2>;
The commands history "is not working": meaning I cannot retrieve these last two commands I entered by hitting the top arrow key.
Instead, I have to type them again.

To try to solve the problem, I entered the command:
<database_name># \set HISTSIZE 100
but it didn't change anything.

Yesterday, I don't remember what I did, but I could access the commands history using Powershell, maybe the command "\set HISTSIZE 100" and maybe a "psqlrc" file.
But whatever I've been trying to do since, I can't make it work again.

Can you please advise me what to do to make this work?

Best regards.
--
Léa Massiot



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.



Re: Commands history with psql in a Windows command line shell

From
Adrian Klaver
Date:
On 08/02/2016 09:19 AM, Lmhelp1 wrote:
> Thank you for your answer.
>
> 1.
> Like I wrote in my first post, the command I use to launch "psql" is:
> cmd.exe> psql -p <tcp_port> -U <username> <database_name>
> So, I do not specify the "--no-readline" option.
>
> 2.
> cmd.exe psql <database_name># \s
> history is not supported by this installation
>
> Powershell psql <database_name># \s
> history is not supported by this installation
>
> To install PostgreSQL, I used the "postgresql-9.5.2-1-windows-x64.exe"
> installer the 2016/04/21.
> So I don't remember much about what I did that day.
>
> 3.
> When I do:
> psql <database_name># \set
> HISTFILE does not appear in the result.
> So, I guess it is not set.

What happens if you use the SQL Shell from the program menu on the Start
Menu?:


http://www.enterprisedb.com/resources-community/tutorials-quickstarts/windows/getting-started-postgres-plus-tutorial-windows

>
> Best regards,
> --
> Léa Massiot
>
>

--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Commands history with psql in a Windows command line shell

From
Lmhelp1
Date:
Thank you for your answer.

With the "SQL Shell" tool, the commands history is indeed available!
So, I guess I am now going to use this tool instead of "cmd.exe".
This solves my problem.

Thank you and best regards.
--
Léa Massiot



On 2016-08-02 6:27 PM, Adrian Klaver wrote:

What happens if you use the SQL Shell from the program menu on the Start Menu?:

http://www.enterprisedb.com/resources-community/tutorials-quickstarts/windows/getting-started-postgres-plus-tutorial-windows





On 2016-08-02 6:19 PM, Lmhelp1 wrote:

Thank you for your answer.

1.
Like I wrote in my first post, the command I use to launch "psql" is:
cmd.exe> psql -p <tcp_port> -U <username> <database_name>
So, I do not specify the "--no-readline" option.

2.
cmd.exe psql <database_name># \s
history is not supported by this installation

Powershell psql <database_name># \s
history is not supported by this installation

To install PostgreSQL, I used the "postgresql-9.5.2-1-windows-x64.exe" installer the 2016/04/21.
So I don't remember much about what I did that day.

3.
When I do:
psql <database_name># \set
HISTFILE does not appear in the result.
So, I guess it is not set.

Best regards,
--
Léa Massiot


On 2016-08-02 5:56 PM, Melvin Davidson wrote:

The following may be pertinent.

If -n / --no-readline was specified, then command history is not used.

What happens if you issue the \s command in psql? Is history supported?

What is the value for HISTFILE?

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.


On Tue, Aug 2, 2016 at 11:40 AM, David G. Johnston <david.g.johnston@gmail.com> wrote:
On Tue, Aug 2, 2016 at 11:31 AM, Melvin Davidson <melvin6925@gmail.com> wrote:
Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide us with a little more useful information like current PostgreSQL version and O/S?
Otherwise we have absolutely no idea what the problem might be.


"Windows (8.1)" refers to the O/S version.

Knowing the PostgreSQL version probably won't make a difference though knowing how it was installed might (though not for me personally).

David J.



On 2016-08-02 5:40 PM, Lmhelp1 wrote:

Thank you for your answer.

cmd.exe> psql --version
psql (PostgreSQL) 9.5.2

Like I wrote, the Windows OS is 8.1 Pro.

Best regards,
--
Léa Massiot


On 2016-08-02 5:31 PM, Melvin Davidson wrote:
Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide us with a little more useful information like current PostgreSQL version and O/S?
Otherwise we have absolutely no idea what the problem might be.

On Tue, Aug 2, 2016 at 11:18 AM, Lmhelp1 <lmhelp1@orange.fr> wrote:
Hello,

I am using "psql" in "cmd.exe" in Windows (8.1).

Below is the command I use to connect to a database with "psql":
cmd.exe> psql -p <tcp_port> -U <username> <database_name>

My problem is the following.
Suppose I enter one command:
<database_name># SELECT * FROM <a_table_1>;
and then another one:
<database_name># SELECT * FROM <a_table_2>;
The commands history "is not working": meaning I cannot retrieve these last two commands I entered by hitting the top arrow key.
Instead, I have to type them again.

To try to solve the problem, I entered the command:
<database_name># \set HISTSIZE 100
but it didn't change anything.

Yesterday, I don't remember what I did, but I could access the commands history using Powershell, maybe the command "\set HISTSIZE 100" and maybe a "psqlrc" file.
But whatever I've been trying to do since, I can't make it work again.

Can you please advise me what to do to make this work?

Best regards.
--
Léa Massiot



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.




Re: Commands history with psql in a Windows command line shell

From
Adrian Klaver
Date:
On 08/02/2016 09:39 AM, Lmhelp1 wrote:
> Thank you for your answer.
>
> With the "SQL Shell" tool, the commands history is indeed available!
> So, I guess I am now going to use this tool instead of "cmd.exe".
> This solves my problem.

Or look at the properties of the menu item and see what is done to
enable history.

>
> Thank you and best regards.
> --
> Léa Massiot
>
>
>
> On 2016-08-02 6:27 PM, Adrian Klaver wrote:
>>
>> What happens if you use the SQL Shell from the program menu on the
>> Start Menu?:
>>
>>
http://www.enterprisedb.com/resources-community/tutorials-quickstarts/windows/getting-started-postgres-plus-tutorial-windows
>>
>>
>
>
>
>
> On 2016-08-02 6:19 PM, Lmhelp1 wrote:
>>
>> Thank you for your answer.
>>
>> 1.
>> Like I wrote in my first post, the command I use to launch "psql" is:
>> cmd.exe> psql -p <tcp_port> -U <username> <database_name>
>> So, I do not specify the "--no-readline" option.
>>
>> 2.
>> cmd.exe psql <database_name># \s
>> history is not supported by this installation
>>
>> Powershell psql <database_name># \s
>> history is not supported by this installation
>>
>> To install PostgreSQL, I used the "postgresql-9.5.2-1-windows-x64.exe"
>> installer the 2016/04/21.
>> So I don't remember much about what I did that day.
>>
>> 3.
>> When I do:
>> psql <database_name># \set
>> HISTFILE does not appear in the result.
>> So, I guess it is not set.
>>
>> Best regards,
>> --
>> Léa Massiot
>>
>>
>> On 2016-08-02 5:56 PM, Melvin Davidson wrote:
>>>
>>> Thank you, Based on
>>> https://www.postgresql.org/docs/9.5/static/app-psql.html#APP-PSQL-ENVIRONMENT
>>>
>>> The following may be pertinent.
>>>
>>> If -n / --no-readline was specified, then command history is not used.
>>>
>>> What happens if you issue the \s command in psql? Is history supported?
>>>
>>> What is the value for HISTFILE?
>>>
>>> --
>>> *Melvin Davidson*
>>> I reserve the right to fantasize.  Whether or not you
>>> wish to share my fantasy is entirely up to you.
>>
>> On Tue, Aug 2, 2016 at 11:40 AM, David G. Johnston
>> <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>>wrote:
>> On Tue, Aug 2, 2016 at 11:31 AM, Melvin Davidson <melvin6925@gmail.com
>> <mailto:melvin6925@gmail.com>> wrote:
>>
>>     Are you doing this in PostgreSQL 7.3 and Windows XP? Can you
>>     provide us with a little more useful information like current
>>     PostgreSQL version and O/S?
>>     Otherwise we have absolutely no idea what the problem might be.
>>
>>
>> "Windows (8.1)" refers to the O/S version.
>>
>> Knowing the PostgreSQL version probably won't make a difference though
>> knowing how it was installed might (though not for me personally).
>>
>> David J.
>>
>>
>>
>> On 2016-08-02 5:40 PM, Lmhelp1 wrote:
>>>
>>> Thank you for your answer.
>>>
>>> cmd.exe> psql --version
>>> psql (PostgreSQL) 9.5.2
>>>
>>> Like I wrote, the Windows OS is 8.1 Pro.
>>>
>>> Best regards,
>>> --
>>> Léa Massiot
>>>
>>>
>>> On 2016-08-02 5:31 PM, Melvin Davidson wrote:
>>>> Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide
>>>> us with a little more useful information like current PostgreSQL
>>>> version and O/S?
>>>> Otherwise we have absolutely no idea what the problem might be.
>>>>
>>>> On Tue, Aug 2, 2016 at 11:18 AM, Lmhelp1 <lmhelp1@orange.fr
>>>> <mailto:lmhelp1@orange.fr>> wrote:
>>>>
>>>>     Hello,
>>>>
>>>>     I am using "psql" in "cmd.exe" in Windows (8.1).
>>>>
>>>>     Below is the command I use to connect to a database with "psql":
>>>>     cmd.exe> psql -p <tcp_port> -U <username> <database_name>
>>>>
>>>>     My problem is the following.
>>>>     Suppose I enter one command:
>>>>     <database_name># SELECT * FROM <a_table_1>;
>>>>     and then another one:
>>>>     <database_name># SELECT * FROM <a_table_2>;
>>>>     The commands history "is not working": meaning I cannot retrieve
>>>>     these last two commands I entered by hitting the top arrow key.
>>>>     Instead, I have to type them again.
>>>>
>>>>     To try to solve the problem, I entered the command:
>>>>     <database_name># \set HISTSIZE 100
>>>>     but it didn't change anything.
>>>>
>>>>     Yesterday, I don't remember what I did, but I could access the
>>>>     commands history using Powershell, maybe the command "\set
>>>>     HISTSIZE 100" and maybe a "psqlrc" file.
>>>>     But whatever I've been trying to do since, I can't make it work
>>>>     again.
>>>>
>>>>     Can you please advise me what to do to make this work?
>>>>
>>>>     Best regards.
>>>>     --
>>>>     Léa Massiot
>>>>
>>>>
>>>>
>>>>     --
>>>>     Sent via pgsql-general mailing list
>>>>     (pgsql-general@postgresql.org <mailto:pgsql-general@postgresql.org>)
>>>>     To make changes to your subscription:
>>>>     http://www.postgresql.org/mailpref/pgsql-general
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Melvin Davidson*
>>>> I reserve the right to fantasize.  Whether or not you
>>>> wish to share my fantasy is entirely up to you.
>>>
>>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Commands history with psql in a Windows command line shell

From
Lmhelp1
Date:
Thank you for your answer.

I can't see any difference.
In "Properties", there is an entry "Command History" with two fields
"Buffer size" set to 50 and "Number of Buffers" set to 4.
These settings are exactly the same in "cmd.exe" and "SQL Shell"...

Best regards,
--
Léa Massiot



On 2016-08-02 6:39 PM, Adrian Klaver wrote:
> On 08/02/2016 09:39 AM, Lmhelp1 wrote:
>> Thank you for your answer.
>>
>> With the "SQL Shell" tool, the commands history is indeed available!
>> So, I guess I am now going to use this tool instead of "cmd.exe".
>> This solves my problem.
>
> Or look at the properties of the menu item and see what is done to
> enable history.
>
>>
>> Thank you and best regards.
>> --
>> Léa Massiot
>>
>>
>>
>> On 2016-08-02 6:27 PM, Adrian Klaver wrote:
>>>
>>> What happens if you use the SQL Shell from the program menu on the
>>> Start Menu?:
>>>
>>>
http://www.enterprisedb.com/resources-community/tutorials-quickstarts/windows/getting-started-postgres-plus-tutorial-windows

>>>
>>>
>>>
>>
>>
>>
>>
>> On 2016-08-02 6:19 PM, Lmhelp1 wrote:
>>>
>>> Thank you for your answer.
>>>
>>> 1.
>>> Like I wrote in my first post, the command I use to launch "psql" is:
>>> cmd.exe> psql -p <tcp_port> -U <username> <database_name>
>>> So, I do not specify the "--no-readline" option.
>>>
>>> 2.
>>> cmd.exe psql <database_name># \s
>>> history is not supported by this installation
>>>
>>> Powershell psql <database_name># \s
>>> history is not supported by this installation
>>>
>>> To install PostgreSQL, I used the "postgresql-9.5.2-1-windows-x64.exe"
>>> installer the 2016/04/21.
>>> So I don't remember much about what I did that day.
>>>
>>> 3.
>>> When I do:
>>> psql <database_name># \set
>>> HISTFILE does not appear in the result.
>>> So, I guess it is not set.
>>>
>>> Best regards,
>>> --
>>> Léa Massiot
>>>
>>>
>>> On 2016-08-02 5:56 PM, Melvin Davidson wrote:
>>>>
>>>> Thank you, Based on
>>>> https://www.postgresql.org/docs/9.5/static/app-psql.html#APP-PSQL-ENVIRONMENT
>>>>
>>>>
>>>> The following may be pertinent.
>>>>
>>>> If -n / --no-readline was specified, then command history is not used.
>>>>
>>>> What happens if you issue the \s command in psql? Is history
>>>> supported?
>>>>
>>>> What is the value for HISTFILE?
>>>>
>>>> --
>>>> *Melvin Davidson*
>>>> I reserve the right to fantasize.  Whether or not you
>>>> wish to share my fantasy is entirely up to you.
>>>
>>> On Tue, Aug 2, 2016 at 11:40 AM, David G. Johnston
>>> <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>>wrote:
>>> On Tue, Aug 2, 2016 at 11:31 AM, Melvin Davidson <melvin6925@gmail.com
>>> <mailto:melvin6925@gmail.com>> wrote:
>>>
>>>     Are you doing this in PostgreSQL 7.3 and Windows XP? Can you
>>>     provide us with a little more useful information like current
>>>     PostgreSQL version and O/S?
>>>     Otherwise we have absolutely no idea what the problem might be.
>>>
>>>
>>> "Windows (8.1)" refers to the O/S version.
>>>
>>> Knowing the PostgreSQL version probably won't make a difference though
>>> knowing how it was installed might (though not for me personally).
>>>
>>> David J.
>>>
>>>
>>>
>>> On 2016-08-02 5:40 PM, Lmhelp1 wrote:
>>>>
>>>> Thank you for your answer.
>>>>
>>>> cmd.exe> psql --version
>>>> psql (PostgreSQL) 9.5.2
>>>>
>>>> Like I wrote, the Windows OS is 8.1 Pro.
>>>>
>>>> Best regards,
>>>> --
>>>> Léa Massiot
>>>>
>>>>
>>>> On 2016-08-02 5:31 PM, Melvin Davidson wrote:
>>>>> Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide
>>>>> us with a little more useful information like current PostgreSQL
>>>>> version and O/S?
>>>>> Otherwise we have absolutely no idea what the problem might be.
>>>>>
>>>>> On Tue, Aug 2, 2016 at 11:18 AM, Lmhelp1 <lmhelp1@orange.fr
>>>>> <mailto:lmhelp1@orange.fr>> wrote:
>>>>>
>>>>>     Hello,
>>>>>
>>>>>     I am using "psql" in "cmd.exe" in Windows (8.1).
>>>>>
>>>>>     Below is the command I use to connect to a database with "psql":
>>>>>     cmd.exe> psql -p <tcp_port> -U <username> <database_name>
>>>>>
>>>>>     My problem is the following.
>>>>>     Suppose I enter one command:
>>>>>     <database_name># SELECT * FROM <a_table_1>;
>>>>>     and then another one:
>>>>>     <database_name># SELECT * FROM <a_table_2>;
>>>>>     The commands history "is not working": meaning I cannot retrieve
>>>>>     these last two commands I entered by hitting the top arrow key.
>>>>>     Instead, I have to type them again.
>>>>>
>>>>>     To try to solve the problem, I entered the command:
>>>>>     <database_name># \set HISTSIZE 100
>>>>>     but it didn't change anything.
>>>>>
>>>>>     Yesterday, I don't remember what I did, but I could access the
>>>>>     commands history using Powershell, maybe the command "\set
>>>>>     HISTSIZE 100" and maybe a "psqlrc" file.
>>>>>     But whatever I've been trying to do since, I can't make it work
>>>>>     again.
>>>>>
>>>>>     Can you please advise me what to do to make this work?
>>>>>
>>>>>     Best regards.
>>>>>     --
>>>>>     Léa Massiot
>>>>>
>>>>>
>>>>>
>>>>>     --
>>>>>     Sent via pgsql-general mailing list
>>>>>     (pgsql-general@postgresql.org
>>>>> <mailto:pgsql-general@postgresql.org>)
>>>>>     To make changes to your subscription:
>>>>> http://www.postgresql.org/mailpref/pgsql-general
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Melvin Davidson*
>>>>> I reserve the right to fantasize.  Whether or not you
>>>>> wish to share my fantasy is entirely up to you.
>>>>
>>>
>>
>
>



Re: Commands history with psql in a Windows command line shell

From
Tom Lane
Date:
Lmhelp1 <lmhelp1@orange.fr> writes:
> cmd.exe psql <database_name># \s
> history is not supported by this installation

This means you have a copy of psql.exe that was built without the readline
library, so history doesn't work either.  I'm not sure what the state of
the readline library is for Windows; there may not be any version that
works well.

            regards, tom lane


Re: Commands history with psql in a Windows command line shell

From
Lmhelp1
Date:
Thank you for this note.
Best regards,
--
Léa Massiot


On 2016-08-02 6:57 PM, Tom Lane wrote:
> Lmhelp1 <lmhelp1@orange.fr> writes:
>> cmd.exe psql <database_name># \s
>> history is not supported by this installation
> This means you have a copy of psql.exe that was built without the readline
> library, so history doesn't work either.  I'm not sure what the state of
> the readline library is for Windows; there may not be any version that
> works well.
>
>             regards, tom lane
>


On 2016-08-02 6:55 PM, Lmhelp1 wrote:
> Thank you for your answer.
>
> I can't see any difference.
> In "Properties", there is an entry "Command History" with two fields
> "Buffer size" set to 50 and "Number of Buffers" set to 4.
> These settings are exactly the same in "cmd.exe" and "SQL Shell"...
>
> Best regards,
> --
> Léa Massiot
>
>
>
> On 2016-08-02 6:39 PM, Adrian Klaver wrote:
>> On 08/02/2016 09:39 AM, Lmhelp1 wrote:
>>> Thank you for your answer.
>>>
>>> With the "SQL Shell" tool, the commands history is indeed available!
>>> So, I guess I am now going to use this tool instead of "cmd.exe".
>>> This solves my problem.
>>
>> Or look at the properties of the menu item and see what is done to
>> enable history.
>>
>>>
>>> Thank you and best regards.
>>> --
>>> Léa Massiot
>>>
>>>
>>>
>>> On 2016-08-02 6:27 PM, Adrian Klaver wrote:
>>>>
>>>> What happens if you use the SQL Shell from the program menu on the
>>>> Start Menu?:
>>>>
>>>>
http://www.enterprisedb.com/resources-community/tutorials-quickstarts/windows/getting-started-postgres-plus-tutorial-windows

>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>> On 2016-08-02 6:19 PM, Lmhelp1 wrote:
>>>>
>>>> Thank you for your answer.
>>>>
>>>> 1.
>>>> Like I wrote in my first post, the command I use to launch "psql" is:
>>>> cmd.exe> psql -p <tcp_port> -U <username> <database_name>
>>>> So, I do not specify the "--no-readline" option.
>>>>
>>>> 2.
>>>> cmd.exe psql <database_name># \s
>>>> history is not supported by this installation
>>>>
>>>> Powershell psql <database_name># \s
>>>> history is not supported by this installation
>>>>
>>>> To install PostgreSQL, I used the "postgresql-9.5.2-1-windows-x64.exe"
>>>> installer the 2016/04/21.
>>>> So I don't remember much about what I did that day.
>>>>
>>>> 3.
>>>> When I do:
>>>> psql <database_name># \set
>>>> HISTFILE does not appear in the result.
>>>> So, I guess it is not set.
>>>>
>>>> Best regards,
>>>> --
>>>> Léa Massiot
>>>>
>>>>
>>>> On 2016-08-02 5:56 PM, Melvin Davidson wrote:
>>>>>
>>>>> Thank you, Based on
>>>>> https://www.postgresql.org/docs/9.5/static/app-psql.html#APP-PSQL-ENVIRONMENT
>>>>>
>>>>>
>>>>> The following may be pertinent.
>>>>>
>>>>> If -n / --no-readline was specified, then command history is not
>>>>> used.
>>>>>
>>>>> What happens if you issue the \s command in psql? Is history
>>>>> supported?
>>>>>
>>>>> What is the value for HISTFILE?
>>>>>
>>>>> --
>>>>> *Melvin Davidson*
>>>>> I reserve the right to fantasize.  Whether or not you
>>>>> wish to share my fantasy is entirely up to you.
>>>>
>>>> On Tue, Aug 2, 2016 at 11:40 AM, David G. Johnston
>>>> <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>>wrote:
>>>> On Tue, Aug 2, 2016 at 11:31 AM, Melvin Davidson <melvin6925@gmail.com
>>>> <mailto:melvin6925@gmail.com>> wrote:
>>>>
>>>>     Are you doing this in PostgreSQL 7.3 and Windows XP? Can you
>>>>     provide us with a little more useful information like current
>>>>     PostgreSQL version and O/S?
>>>>     Otherwise we have absolutely no idea what the problem might be.
>>>>
>>>>
>>>> "Windows (8.1)" refers to the O/S version.
>>>>
>>>> Knowing the PostgreSQL version probably won't make a difference though
>>>> knowing how it was installed might (though not for me personally).
>>>>
>>>> David J.
>>>>
>>>>
>>>>
>>>> On 2016-08-02 5:40 PM, Lmhelp1 wrote:
>>>>>
>>>>> Thank you for your answer.
>>>>>
>>>>> cmd.exe> psql --version
>>>>> psql (PostgreSQL) 9.5.2
>>>>>
>>>>> Like I wrote, the Windows OS is 8.1 Pro.
>>>>>
>>>>> Best regards,
>>>>> --
>>>>> Léa Massiot
>>>>>
>>>>>
>>>>> On 2016-08-02 5:31 PM, Melvin Davidson wrote:
>>>>>> Are you doing this in PostgreSQL 7.3 and Windows XP? Can you provide
>>>>>> us with a little more useful information like current PostgreSQL
>>>>>> version and O/S?
>>>>>> Otherwise we have absolutely no idea what the problem might be.
>>>>>>
>>>>>> On Tue, Aug 2, 2016 at 11:18 AM, Lmhelp1 <lmhelp1@orange.fr
>>>>>> <mailto:lmhelp1@orange.fr>> wrote:
>>>>>>
>>>>>>     Hello,
>>>>>>
>>>>>>     I am using "psql" in "cmd.exe" in Windows (8.1).
>>>>>>
>>>>>>     Below is the command I use to connect to a database with "psql":
>>>>>>     cmd.exe> psql -p <tcp_port> -U <username> <database_name>
>>>>>>
>>>>>>     My problem is the following.
>>>>>>     Suppose I enter one command:
>>>>>>     <database_name># SELECT * FROM <a_table_1>;
>>>>>>     and then another one:
>>>>>>     <database_name># SELECT * FROM <a_table_2>;
>>>>>>     The commands history "is not working": meaning I cannot retrieve
>>>>>>     these last two commands I entered by hitting the top arrow key.
>>>>>>     Instead, I have to type them again.
>>>>>>
>>>>>>     To try to solve the problem, I entered the command:
>>>>>>     <database_name># \set HISTSIZE 100
>>>>>>     but it didn't change anything.
>>>>>>
>>>>>>     Yesterday, I don't remember what I did, but I could access the
>>>>>>     commands history using Powershell, maybe the command "\set
>>>>>>     HISTSIZE 100" and maybe a "psqlrc" file.
>>>>>>     But whatever I've been trying to do since, I can't make it work
>>>>>>     again.
>>>>>>
>>>>>>     Can you please advise me what to do to make this work?
>>>>>>
>>>>>>     Best regards.
>>>>>>     --
>>>>>>     Léa Massiot
>>>>>>
>>>>>>
>>>>>>
>>>>>>     --
>>>>>>     Sent via pgsql-general mailing list
>>>>>>     (pgsql-general@postgresql.org
>>>>>> <mailto:pgsql-general@postgresql.org>)
>>>>>>     To make changes to your subscription:
>>>>>> http://www.postgresql.org/mailpref/pgsql-general
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Melvin Davidson*
>>>>>> I reserve the right to fantasize.  Whether or not you
>>>>>> wish to share my fantasy is entirely up to you.
>>>>>
>>>>
>>>
>>
>>
>