[GENERAL] Where do I enter commands?

2015-10-24 Thread David Blomstrom
I just installed PostgreSQL and started reading the tutorial @ http://www.postgresql.org/docs/8.0/static/tutorial-createdb.html and was snowed at square one. To create a database, I'm supposed to type the following command: $ createdb mydb But it doesn't say where I'm supposed to type it. When I

Re: [GENERAL] Where do I enter commands?

2015-10-24 Thread David Blomstrom
Good tip; I can now see the database I created. Thanks. On Sat, Oct 24, 2015 at 8:20 PM, Adrian Klaver <adrian.kla...@aklaver.com> wrote: > On 10/24/2015 08:00 PM, David Blomstrom wrote: > >> "Is there a entry under Servers?" >> >> PostgreSQL 9.

Re: [GENERAL] Where do I enter commands?

2015-10-24 Thread David Blomstrom
"Is there a entry under Servers?" PostgreSQL 9.5 (localhost) - but there's a red X over it. On Sat, Oct 24, 2015 at 7:52 PM, Adrian Klaver <adrian.kla...@aklaver.com> wrote: > On 10/24/2015 07:44 PM, David Blomstrom wrote: > >> Hmmm...I have pgAdminIII. When I click

Re: [GENERAL] Where do I enter commands?

2015-10-24 Thread David Blomstrom
found" error message. On Sat, Oct 24, 2015 at 6:35 PM, Adrian Klaver <adrian.kla...@aklaver.com> wrote: > On 10/24/2015 06:21 PM, David Blomstrom wrote: > >> I just installed PostgreSQL and started reading the tutorial @ >> http://www.postgresql.org/docs/8.0/static/tutori

Re: [GENERAL] Where do I enter commands?

2015-10-24 Thread David Blomstrom
Hmmm...I have pgAdminIII. When I click on Server, there's no option to create a database. On Sat, Oct 24, 2015 at 7:37 PM, John R Pierce <pie...@hogranch.com> wrote: > On 10/24/2015 7:33 PM, David Blomstrom wrote: > >> I'd greatly prefer a GUI. It seems like a comma

Re: [GENERAL] Where do I enter commands?

2015-10-24 Thread David Blomstrom
I'd greatly prefer a GUI. It seems like a command-line tool would be incredibly tedious when creating tables, modifying them, filling them with data, etc. Thanks. On Sat, Oct 24, 2015 at 7:28 PM, Adrian Klaver <adrian.kla...@aklaver.com> wrote: > On 10/24/2015 07:20 PM, David Blomst

Re: [GENERAL] Where do I enter commands?

2015-10-24 Thread David Blomstrom
> possibilities. I personally find the command line more productive, but > there is a learning curve. > > >> >> > > -- > Adrian Klaver > adrian.kla...@aklaver.com > -- David Blomstrom Writer & Web Designer (Mac, M$ & Linux) www.geobop.org

Re: [GENERAL] Recursive Arrays 101

2015-10-25 Thread David Blomstrom
. The Encyclopedia of Life and WIkipedia are both enormous projects, but there are some amazing gaps in both projects that I hope to fill. On Sun, Oct 25, 2015 at 8:51 PM, Adrian Klaver <adrian.kla...@aklaver.com> wrote: > On 10/25/2015 06:10 PM, David Blomstrom wrote: > >> @ Adr

Re: [GENERAL] Recursive Arrays 101

2015-10-25 Thread David Blomstrom
, 2015 at 2:07 PM, Alban Hertroys <haram...@gmail.com> wrote: > > > On 25 Oct 2015, at 19:38, Adrian Klaver <adrian.kla...@aklaver.com> > wrote: > > > > On 10/25/2015 11:12 AM, David Blomstrom wrote: > >> I'm sorry, I don't know exactly what you

Re: [GENERAL] Recursive Arrays 101

2015-10-25 Thread David Blomstrom
to learn how to use the new search function, Elastic, or whatever it's called. Speaking of which, I just discovered the new Russian and Chinese search engines, Yandex and Baidu. They have some interesting possibilities, too. ;) On Sun, Oct 25, 2015 at 9:12 PM, David Blomstrom <david.blomst...@gmail.

Re: [GENERAL] Recursive Arrays 101

2015-10-25 Thread David Blomstrom
Making it more confusing, I believe there are several different series of numerical ID's. See this page, for example... https://www.wikidata.org/wiki/Q46212 On Sun, Oct 25, 2015 at 9:10 PM, David Blomstrom <david.blomst...@gmail.com> wrote: > It's also interesting that some entities

Re: [GENERAL] Recursive Arrays 101

2015-10-25 Thread David Blomstrom
mean. Then again, when I navigate to the Encyclopedia of Life's aardvark page @ http://www.eol.org/pages/327830/overview the code is actually amazingly short. On Sun, Oct 25, 2015 at 9:04 PM, David Blomstrom <david.blomst...@gmail.com> wrote: > What was amazed me is the HUGE tables (

Re: [GENERAL] Recursive Arrays 101

2015-10-25 Thread David Blomstrom
does one choose? But it's amazing how many "aliases" are attached to many taxonomic names; utterly bewildering. On Sun, Oct 25, 2015 at 10:09 PM, Adrian Klaver <adrian.kla...@aklaver.com> wrote: > On 10/25/2015 09:10 PM, David Blomstrom wrote: > >> It's also interesting

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
Server [localhost]: /l Database [postgres]: * * * * * Server [localhost]: /dt Database [postgres]: * * * * * However...I've noticed that when I open up the shell, I get multiple instances - sometimes over half a dozen. If I type the same things into one of the other instances, I get this:

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
n Davidson <melvin6...@gmail.com> wrote: > The law of O/S & databases: > For every Linux / PostgreSQL user, there is and equal an opposite Mac / > MySQL user. > However, the latter is completely useless. > > On Mon, Oct 26, 2015 at 8:54 PM, David Blomstrom < > d

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
Adrian Klaver wrote: >>>> >>>>> On 10/26/2015 08:12 AM, Rob Sargent wrote: >>>>> >>>>>> On 10/26/2015 08:43 AM, Jim Nasby wrote: >>>>>> >>>>>>> On 10/25/15 8:10 PM, David Blomstrom wrote: >>>>

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
OK, I figured out how to drop the primary key and change the NULLS. So it looks like this now: CREATE TABLE public.gz_life_mammals ( id integer NOT NULL, taxon text NOT NULL, parent text NOT NULL, slug text, namecommon text, plural text, extinct smallint NOT NULL, rank smallint

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
What does "top post" mean? And what do you mean by "embedded spaces"? Are you referring to the underscores in the TABLE name? On Mon, Oct 26, 2015 at 2:12 PM, Gavin Flower <gavinflo...@archidevsys.co.nz > wrote: > Hi David, > > Please don't top post! >

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
more complicated when you get into "specialist names." ;) But the system I've set up so far seems to be working pretty nicely. On Mon, Oct 26, 2015 at 1:41 PM, Rob Sargent <robjsarg...@gmail.com> wrote: > On 10/26/2015 02:29 PM, David Blomstrom wrote: > >> Sorry for the

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
); $Total = $stmt->fetch(); On Mon, Oct 26, 2015 at 1:51 PM, David Blomstrom <david.blomst...@gmail.com> wrote: > I'm focusing primarily on vertebrates at the moment, which have a total of > (I think) about 60,000-70,000 rows for all taxons (species, families, > etc.). My go

[GENERAL] Importing CSV File

2015-10-26 Thread David Blomstrom
I tried to import a CSV file into a PostgreSQL table using pgAdmin III. I got an error message: "extra data after last column." All my spreadsheets have an "end of data" column that has /r/n in each cell. When I import a CSV file into a MySQL table, everything beyond /r/n is ignored. Is there

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
When I type in /l, it just says "database Postgres," even though I can see TWO databases in pgAdmin III. When I type in /dt, it says Username [postgres]. On Mon, Oct 26, 2015 at 3:40 PM, Gavin Flower <gavinflo...@archidevsys.co.nz > wrote: > On 27/10/15 11:18, Da

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
Oops, let me try it again... *Shell1* Server [localhost]: \l Database [postgres]: * * * * * Server [localhost]: \dt Database [postgres]: *Shell2* Database [postgres]: \l Port [5432]: * * * * * Port [5432]: \dt Username [postgres]:

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
:30 PM, John R Pierce <pie...@hogranch.com> wrote: > On 10/26/2015 4:27 PM, David Blomstrom wrote: > >> I have two PostgreSQL icons on my taskbar - a blue elephant (pgAdmin III) >> and a little monitor (PSQL). When I click on PSQL, it always opens at least >> two win

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
onomic levels (e.g. kingdom, class, etc.), then it should be easy to rename the table, delete a few columns, and refill it with data associated with a particular class. On Mon, Oct 26, 2015 at 1:29 PM, David Blomstrom <david.blomst...@gmail.com> wrote: > Sorry for the late response. I don'

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
Here's what it looks like now: CREATE TABLE public.gz_life_mammals ( id integer NOT NULL, taxon text NOT NULL, parent text NOT NULL, slug text, namecommon text, plural text, extinct smallint NOT NULL, rank smallint NOT NULL, key smallint NOT NULL, CONSTRAINT "Primary Key"

Re: [GENERAL] Importing CSV File

2015-10-26 Thread David Blomstrom
Wow, I must be getting dyxlexic; yes, it is \r\n I guess it would be easy enough to just copy the stuff I want to import into a separate spreadsheet and save it as a CSV. I've done that before with really big spreadsheets, actually. Thanks.

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
; just a fluke, I guess. On Mon, Oct 26, 2015 at 4:22 PM, Gavin Flower <gavinflo...@archidevsys.co.nz > wrote: > On 27/10/15 12:15, David Blomstrom wrote: > >> >> Server [localhost]: \c geozoo2 david >> >> Database [postgres]: >> >> >>

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
Last login: Mon Oct 26 16:35:25 on ttys002 /Library/PostgreSQL/9.5/scripts/runpsql.sh; exit Davids-MacBook-Pro-2:~ davidblomstrom$ /Library/PostgreSQL/9.5/scripts/runpsql.sh; exit Server [localhost]: \l Database [postgres]: \dt Port [5432]: Username [postgres]: Cmd-Spacebar Terminalpsql:

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
atch script, >> > > Actually OS X : > > > http://www.postgresql.org/message-id/CAA54Z0hdYkqDDYP=8s577rwvz4qrn9+-mjkeyrot69um3ra...@mail.gmail.com > > > -- > Adrian Klaver > adrian.kla...@aklaver.com > > > > -- > Sent via pgsql-general mailing list (pgsql-

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
On Mon, Oct 26, 2015 at 5:02 PM, Adrian Klaver <adrian.kla...@aklaver.com> wrote: > On 10/26/2015 04:42 PM, David Blomstrom wrote: > >> Last login: Mon Oct 26 16:35:25 on ttys002 >> >> /Library/PostgreSQL/9.5/scripts/runpsql.sh; exit >> >> Davids-M

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
PM, David Blomstrom < > david.blomst...@gmail.com> wrote: > >> Server [localhost]: Server [localhost]: >> >> Database [postgres]: Database [postgres]: >> >> Port [5432]: Port [5432]: >> >> Username [postgres]: Username [postgres]: >> > What

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
rain! > > > > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > -- David Blomstrom Writer & Web Designer (Mac, M$ & Linux) www.geobop.org

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
I pasted this into the shell... CREATE ROLE david LOGIN CREATEDB; CREATE DATABASE GeoZoo2 OWNER david; and I did it again, replacing LOGIN with my password, but when I refresh pgAdmin III, there are no new databases. And when I paste this in, it doesn't create a table... CREATE TABLE

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
On Mon, Oct 26, 2015 at 4:19 PM, Adrian Klaver <adrian.kla...@aklaver.com> wrote: > On 10/26/2015 04:13 PM, David Blomstrom wrote: > >> Oops, let me try it again... >> > > Still not making sense. > > Show the exact command you are using to get the below

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
No, I'm on a Mac running OS X El Capitan.

Re: [GENERAL] Recursive Arrays 101

2015-10-26 Thread David Blomstrom
straining. For you they may be liberating. Stick with pgAdmin and ask > questions about it. There may even be a forum dedicated to it. > > Someday we can revisit "power tools" > > On Oct 26, 2015, at 7:08 PM, David Blomstrom <david.blomst...@gmail.com> > wrote: &g

[GENERAL] Hierarchical Query Question (PHP)

2015-10-29 Thread David Blomstrom
Can anyone tell me how to write the query described @ http://stackoverflow.com/questions/33402831/count-descendants-in-hierarchical-query ? The answer's very thorough, but I don't know how to string two queries and a function together like that. This doesn't work: $sql = "select * from

Re: [GENERAL] Where do I enter commands?

2015-10-25 Thread David Blomstrom
09:19 PM, David Blomstrom wrote: > >> I'm a writer. I studied programing and MySQL so I could create websites >> that I can publish my articles to. I don't have time to keep up with the >> endless technology - MySQL, PDO, stored procedures, PHP, JavaScript, >> JQuery, an

Re: [GENERAL] Where do I enter commands?

2015-10-25 Thread David Blomstrom
e start, it is going to be rewarding. > > Hope this helps your decision process > Alex > > > > On 25 Oct 2015, at 1:28 p.m., Adrian Klaver <adrian.kla...@aklaver.com> > wrote: > > > > On 10/24/2015 09:19 PM, David Blomstrom wrote: > >> I'm a writer. I

Re: [GENERAL] Recursive Arrays 101

2015-10-25 Thread David Blomstrom
es creating TWO numerical fields - a process that I think >> would be overwhelming when working with over 50,000 taxonomic names. >> >> So that's my question; can I do all this recursive stuff in Postgre with >> the table structure posted above, or will I still have to add a second >> numerical column (or otherwise my table)? >> >> >> >> > > -- > Adrian Klaver > adrian.kla...@aklaver.com > -- David Blomstrom Writer & Web Designer (Mac, M$ & Linux) www.geobop.org

Re: [GENERAL] Using PostgreSQL with MySQL

2015-10-25 Thread David Blomstrom
09:37 AM, David Blomstrom wrote: > >> I've already learned that I can install and use MySQL and PostgreSQL >> simultaneously on my laptop, though I haven't yet learned how to connect >> to my Postgre database from a web page, write a query, etc. So here's >> what I'm plann

Re: [GENERAL] Where do I enter commands?

2015-10-25 Thread David Blomstrom
<karsten.hilb...@gmx.net> wrote: > On Sun, Oct 25, 2015 at 08:32:43AM -0700, David Blomstrom wrote: > > > Someone said when you add a new column in Postgre, it's appended to the > end > > of the table. Does that mean that's where it has to stay, or can you > > rearrange c

[GENERAL] Recursive Arrays 101

2015-10-25 Thread David Blomstrom
I'm creating a website focusing on living things (mostly animals). I have multiple huge MySQL database tables with animal taxons arranged in a parent-child relationship. I was trying to figure out how I could navigate to a URL like MySite/life/mammals and display the number of children (i.e.

[GENERAL] Using PostgreSQL with MySQL

2015-10-25 Thread David Blomstrom
I've already learned that I can install and use MySQL and PostgreSQL simultaneously on my laptop, though I haven't yet learned how to connect to my Postgre database from a web page, write a query, etc. So here's what I'm planning... I have several big, complex websites driven by a MySQL database.

Re: [GENERAL] Hierarchical Query Question (PHP)

2015-10-30 Thread David Blomstrom
Thanks for the tips. In pgAdmin III, I can create a table step-by-step by choosing Edit > Object > New Table But is there a pace for me to past in a block of code that creates the table with just one process? If I click on the SQL icon, a SQL window opens up, and I can past the code into SQL

Re: [GENERAL] Hierarchical Query Question (PHP)

2015-10-30 Thread David Blomstrom
No, I get the same T_FUNCTION error. Someone commented that the function... create function tax_rank(id integer) returns text as $$ select case id when 1 then 'Classes' when 2 then 'Orders' when 3 then 'Families' when 4 then 'Genera'

Re: [GENERAL] Hierarchical Query Question (PHP)

2015-10-30 Thread David Blomstrom
The field descr would presumably hold the values I originally had in the field Taxon - e.g. the names of various taxons, like 'Mammalia' and 'Canis-lupus.' The field id is just a numerical key, and I already have the numerical values for parentid. But what am I supposed to put in the field

Re: [GENERAL] Hierarchical Query Question (PHP)

2015-10-30 Thread David Blomstrom
Yes, I guess it does make sense to keep a copy of your actions. In the meantime, I now have two new tables with the following schema: -- Table: public.taxon -- DROP TABLE public.taxon; CREATE TABLE public.taxon ( taxonid integer NOT NULL DEFAULT nextval('taxon_taxonid_seq'::regclass),

Re: [GENERAL] Hierarchical Query Question (PHP)

2015-10-30 Thread David Blomstrom
Sorry, I don't think I specified that at the beginning. My original/master table has several fields, four of which are relevant to this hierarchical stuff - id, taxon, parent, parent_id. The first is a numerical key, from 1 to probably somewhere around 8,000 for mammals, 1 to 10,000 for birds,

Re: [GENERAL] Hierarchical Query Question (PHP)

2015-10-30 Thread David Blomstrom
I think I answered my question @ http://www.the-art-of-web.com/sql/lookup-table/ It sounds like the field taxon_id is similar to the field id - it's just automatically populated by a numerical key. So if I add a new taxon on row 5, then the taxon_id for the following row with change from 5 to 6

[GENERAL] Selectively Importing Data

2015-10-30 Thread David Blomstrom
First consider the following table: create table taxon ( taxonid serial, descr text ); As I understand it, "serial" means that column will automatically populate with a numerical key. If I want to fill the field 'descr' with a list of scientific names stored in a spreadsheet, then how would

Re: [GENERAL] Recursive Arrays 101

2015-11-04 Thread David Blomstrom
By the > title one might assume could be applied to populations as opposed to > phylogeny (the OP's use case). Does it deal with consanguinity? Does it > perform well going "up" the tree (which is of course branched at every > level)? > -- David Blomstrom Writer & Web Designer (Mac, M$ & Linux) www.geobop.org

Re: [GENERAL] Hierarchical Query Question (PHP)

2015-10-30 Thread David Blomstrom
at 3:36 PM, Adrian Klaver <adrian.kla...@aklaver.com> wrote: > On 10/30/2015 03:29 PM, David Blomstrom wrote: > >> Thanks for the tips. >> >> In pgAdmin III, I can create a table step-by-step by choosing Edit > >> Object > New Table >> >> Bu

Re: [GENERAL] Hierarchical Query Question (PHP)

2015-10-30 Thread David Blomstrom
Just so I understand what's going on, I can create a lookup table by pasting this code... create table taxon ( taxonid serial, descr text ); create table gz_life_mammals ( id serial, taxonid integer, -- use the lookup table parentid integer -- use the lookup table ); ...into pgAdmin

Re: [GENERAL] Selectively Importing Data

2015-10-31 Thread David Blomstrom
postgresql.org [mailto: > pgsql-general-ow...@postgresql.org] On Behalf Of Raymond O'Donnell > > Sent: Samstag, 31. Oktober 2015 12:42 > > To: David Blomstrom <david.blomst...@gmail.com>; > pgsql-general@postgresql.org > > Subject: Re: [GENERAL] Selectively Importing Data &g

Re: [GENERAL] Hierarchical Query Question (PHP)

2015-10-31 Thread David Blomstrom
Awesome; thanks! On Sat, Oct 31, 2015 at 7:19 AM, Andy Colson <a...@squeakycode.net> wrote: > On 10/30/2015 05:10 PM, David Blomstrom wrote: > >> Just so I understand what's going on, I can create a lookup table by >> pasting this code... >> >> > I don't k