Need followup setup instructions to postgresql-10.3-1-linux-x64.run

2018-03-09 Thread Sherman Willden
Name: Sherman
Platform: HP Compaq 6710b
Operating System: Ubuntu 17.10 Fresh Install
postgresql: 10 Fresh Install. No other versions

What post-setup must I perform to get postgresql 10 running.

I used postgresql-10.3-1-linux-x64.run which ran great. It place postgresql
in /opt/PostgreSql. I am logged in as sql-dev the user I created when
installing Ubuntu.

Now I can't even recognize postgres. postgres has a system password and
sql-dev has a system password. I have to run all commands from
/opt/PostgreSQL/10/bin or such. postgres receives a password authentication
failed for user "postgres". Also for "sql-dev".

I have postgresql-10-A4.pdf but I haven't recognized what I need there yet.

Thank you;

Sherman


Re: How do I get rid of database test-aria

2018-02-13 Thread Sherman Willden
Yes the double quotes worked. I tried single quotes but since that didn't
work I just assumed that double quotes would not work either.

Thanks all;

Sherman

On Tue, Feb 13, 2018 at 1:41 PM, Adrian Klaver <adrian.kla...@aklaver.com>
wrote:

> On 02/13/2018 12:38 PM, Sherman Willden wrote:
>
>> development platform: HP Compaq 6710b
>> postgresql 9.6
>> Operating System: Ubuntu 17.10
>>
>> It probably doesn't matter since there is nothing in the database. I
>> don't remember  how I created the database. It appears that postgresql does
>> not like a dash in the database name. I have not tried to create a table
>> under the database. When I try to drop the database I get the following..
>>
>> date_time=# DROP DATABASE test-aria;
>> ERROR:  syntax error at or near "-"
>> LINE 1: DROP DATABASE test-aria;
>>
>
> DROP DATABASE "test-aria";
>
> See below for more info:
>
> https://www.postgresql.org/docs/10/static/sql-syntax-lexical
> .html#SQL-SYNTAX-IDENTIFIERS
>
>
>> Thanks;
>>
>> Sherman
>>
>
>
> --
> Adrian Klaver
> adrian.kla...@aklaver.com
>


How do I get rid of database test-aria

2018-02-13 Thread Sherman Willden
development platform: HP Compaq 6710b
postgresql 9.6
Operating System: Ubuntu 17.10

It probably doesn't matter since there is nothing in the database. I don't
remember  how I created the database. It appears that postgresql does not
like a dash in the database name. I have not tried to create a table under
the database. When I try to drop the database I get the following..

date_time=# DROP DATABASE test-aria;
ERROR:  syntax error at or near "-"
LINE 1: DROP DATABASE test-aria;

Thanks;

Sherman


Best non-networked front end for postgresql

2018-01-21 Thread Sherman Willden
Name: Sherman

Single laptop: Compaq 6710b

Operating System: Ubuntu 17.10

Postgresql: 9.6

Used for: Just me and my home database

Seeking advice: Best non-networked front-end

Considerations: I am retired and want to create my own database and
database captures. I have experience with PERL

Basic question 1: Which non-networked front-end would work best for me?

Basic question 2: I am seriously considering HTML fields to capture and
process the information. So to connect with postgresql what do I need to
know? Do I need to know javascript, python, and other languages? How is
PERL for something like this?

I am entering the below values by hand into a functional database. I
thought that I would create some type of front-end to enter the values and
then have the front-end enter the values into the postgresql database.
01). visit_date
02). start_time
03). end_time
04). venue (This is the casino name)
05). city
06). state
07). limit (4/8 20/40 etc)
08). game (7-card-stud etc)
09). variant (fixed-limit no-limit etc)
10). high-low (mixed-high-low high-only etc)
11). buy_in
12). cash_out

Thank you;

Sherman


Insert results in 0 1

2018-01-15 Thread Sherman Willden
Computer HP Compaq 6710b
Development Platform: Ubuntu 17.10 mainly command line work
Tools: perl 5.26 and postgresql 9.6

Why do I get a 0 1 when using insert?

Thanks;

Sherman
classical=# INSERT INTO string_groups VALUES('et_b_02', 'Sonata in B
minor', 'Eroica Trio', 'Jean Baptiste Loeillet', 'Baroque');
INSERT 0 1
classical=# INSERT INTO string_groups VALUES('et_b_02', 'Sonata in B
minor', 'Eroica Trio', 'Jean Baptiste Loeillet', 'Baroque');
ERROR:  duplicate key value violates unique constraint "string_groups_pkey"
DETAIL:  Key (id)=(et_b_02) already exists.


Re: Find duplicates in a column then print Information to a file

2017-12-31 Thread Sherman Willden
Thank you for the replies. I will start working on them now. Not a student
but since I now have the time I may look into it. I am 71 retired working
at Home Depot. I have a collection of CDs by various artists and I have the
time to create and maintain my own database concerning these subjects. I
retired from USAF, SUN Microsystems, and HP where I worked with the UNIX
systems. As I said my main question right now is which duplicate songs do I
have and who performs them. I really appreciate the support I get here.

Sherman

On Sun, Dec 31, 2017 at 11:53 AM, Francisco Olarte <fola...@peoplecall.com>
wrote:

> M, I notice a faint homework smell here ;-> , but the question is
> nicely asked so:
>
> On Sun, Dec 31, 2017 at 7:19 PM, Sherman Willden
> <operasopra...@gmail.com> wrote:
> ...
> > SELECT aria FROM aria_precis WHERE aria IN (SELECT aria FROM aria_precis
> > GROUP BY aria  HAVING COUNT(aria)>1);
>
> The outer select is fully redundant. Just use the inner one. In fact,
> not redundnat, harmful, as it will spit many copies of aria for the
> duplicated ones. If you add id (and/or artist) to the outer query then
> it is useful again.
>
>
> > When I perform the following I get (0 rows):
> > SELECT aria FROM aria_precis WHERE aria IN (SELECT aria FROM aria_precis
> > GROUP BY id, aria  HAVING COUNT(aria)>1);
>
> As expected. See the inner query, you are grouping by ID which is the
> primary key, by PK definition all counts are going to be one, so no
> results, nothing goes to the outer query.
>
> Use the first query, but adding id and artist to the OUTER level.
>
> > After I get the above information how do I write that information to a
> file?
> > The only thing I know writes the entire database to a file:
> >  \COPY aria_precis TO '/home/sherman/aria_precis_2.csv' WITH DELIMITER
> '#,'
> > CSV HEADER;
>
> If copy format is ok to you, knowing \copy look at the docs, looking
> at https://www.postgresql.org/docs/9.6/static/app-psql.html you will
> read:
>
> >>>
> \copy { table [ ( column_list ) ] | ( query ) } { from | to } {
> 'filename' | program 'command' | stdin | stdout | pstdin | pstdout } [
> [ with ] ( option [, ...] ) ]
>
> Performs a frontend (client) copy. This is an operation that runs an
> SQL COPY command, but instead of the server reading or writing the
> specified file, psql reads or writes the file and routes the data
> between the server and the local file system. This means that file
> accessibility and privileges are those of the local user, not the
> server, and no SQL superuser privileges are required.
> <<<
>
> Notice the (query) option? Your copy is using the table+optional
> column list format, (aria_precis), just change it to the "( query )"
> format ( NOTICE THE MANDATORY PARENS, this is how copy knows what to
> do. "t" => table, "t(c1)"=>table+columns, "(xx)" => query ( nothing
> before the opening parens ). )
>
> Happy new year.
>
> Francisco Olarte.
>


Find duplicates in a column then print Information to a file

2017-12-31 Thread Sherman Willden
Development Platform: Ubuntu 17.10 mainly command line work

Tools: perl 5.26 and postgresql 9.6

Goal: Display duplicate aria titles on screen and to a local file

Database name: arias

Table name: aria_precis

csv delimiter: the # symbol

arias=# \d aria_precis
   Table "public.aria_precis"
   Column| Type | Modifiers
-+--+---
 id  | text | not null
 aria| text |
 artist  | text |
 a_artist| text |
 album_title | text |
Indexes:
"aria_precis_pkey" PRIMARY KEY, btree (id)

Problems:
  1. Can't connect aria title to id
  2. Can't write discovered information to file

I know about this link but I probably didn't understand what I read there.
https://www.postgresql.org/docs/current/static/sql-select.html#SQL-WITH

What I know displays the 46 duplicate aria titles of 413 entries but not
the id or artist:
SELECT aria FROM aria_precis WHERE aria IN (SELECT aria FROM aria_precis
GROUP BY aria  HAVING COUNT(aria)>1);

When I perform the following I get (0 rows):
SELECT aria FROM aria_precis WHERE aria IN (SELECT aria FROM aria_precis
GROUP BY id, aria  HAVING COUNT(aria)>1);
 aria
--
(0 rows)

After I get the above information how do I write that information to a
file? The only thing I know writes the entire database to a file:
 \COPY aria_precis TO '/home/sherman/aria_precis_2.csv' WITH DELIMITER '#,'
CSV HEADER;

Thank you;

Sherman