http://lists.fedoraproject.org/pipermail/users/2013-May/435615.html
Sorry deleted your message and then was viewing it on the web.
You write: Booking_development=> SELECT "registers".* FROM "registers" ORDER BY lname shows nothing because it's a database not a table, but I do not understand how to get at it's tables'.
I reply:
The syntax implies that you have a schema by the name of "registers."
Are you trying to see everything in the "registers" table?
If so, I would first check to see what tables are available in booking_development
From a psql prompt, type: \dt
That should show you the tables that are in the public schema; do you also have other schemas? Typing \dt *.* can give you verbose results but it should show you other schemas if they are there.
If all you want to do is to see what is in the "registers" table, then the SQL would be: SELECT * FROM registers ORDER BY lname (providing "lname" is a field in the "registers" table).
Hope that helps,
Max Pyziur pyz@brama.com
On 05/16/2013 09:51 PM, Max Pyziur wrote:
http://lists.fedoraproject.org/pipermail/users/2013-May/435615.html
Sorry deleted your message and then was viewing it on the web.
You write: Booking_development=> SELECT "registers".* FROM "registers" ORDER BY lname shows nothing because it's a database not a table, but I do not understand how to get at it's tables'.
I reply:
The syntax implies that you have a schema by the name of "registers."
Are you trying to see everything in the "registers" table?
If so, I would first check to see what tables are available in booking_development
From a psql prompt, type: \dt
That should show you the tables that are in the public schema; do you also have other schemas? Typing \dt *.* can give you verbose results but it should show you other schemas if they are there.
If all you want to do is to see what is in the "registers" table, then the SQL would be: SELECT * FROM registers ORDER BY lname (providing "lname" is a field in the "registers" table).
Thanks Max I though so too. I tried SELECT * FROM registers ORDER BY lname it returns nothing, meaning the table doesn't exist or is empty. So where would Rails put tables?I have no luck finding, yet they do seem to exist and show results in the rails app. It seems the registers table is not in booking_development and I cannot find where it may be.
As for the integer problem I think I'll recreate the table and use integer instead of string before it gets useable data entered. More searching thanks Roger
On Fri, 17 May 2013, Roger wrote:
On 05/16/2013 09:51 PM, Max Pyziur wrote:
[... deleted for the sake of brevity ...]
Late getting back to the party ...
Thanks Max I though so too. I tried SELECT * FROM registers ORDER BY lname it returns nothing, meaning the table doesn't exist or is empty.
If the table doesn't exist, you'll get a message saying "relation doesn't exist." More like, there is no data in the table.
So where would Rails put tables?I have no luck finding, yet they do seem to exist and show results in the rails app. It seems the registers table is not in booking_development and I cannot find where it may be.
Start with finding the database name; from a command-line, type: psql -l
That should give you a list of postgresql databases hosted on a machine. It will also tell you who the owner is (and that gives you a clue as to access).
From a commandline:
psql <databasename>
will get you into postgresql's database monitor, providing you have privileges.
Once in the monitor, you can type \dt for list of tables.
Conversely, you can get a schema by typing from a commandline: pg_dump -s <databasename>
Output it to a file (pg_dump -s <databasename> > filename) or grep out the lines in which you are interested (pg_dump -s <databasename> | grep "CREATE TABLE") is one way of getting a list of tables from the commandline.
As for the integer problem I think I'll recreate the table and use integer instead of string before it gets useable data entered. More searching thanks Roger
Max Pyziur pyz@brama.com
Apologies for top post Thanks this is most helpful Roger
On Fri, 17 May 2013, Roger wrote:
On 05/16/2013 09:51 PM, Max Pyziur wrote:
[... deleted for the sake of brevity ...]
Late getting back to the party ...
Thanks Max I though so too. I tried SELECT * FROM registers ORDER BY lname it returns nothing, meaning the table doesn't exist or is empty.
If the table doesn't exist, you'll get a message saying "relation doesn't exist." More like, there is no data in the table.
So where would Rails put tables?I have no luck finding, yet they do seem to exist and show results in the rails app. It seems the registers table is not in booking_development and I cannot find where it may be.
Start with finding the database name; from a command-line, type: psql -l
That should give you a list of postgresql databases hosted on a machine. It will also tell you who the owner is (and that gives you a clue as to access).
From a commandline: psql <databasename>
will get you into postgresql's database monitor, providing you have privileges.
Once in the monitor, you can type \dt for list of tables.
Conversely, you can get a schema by typing from a commandline: pg_dump -s <databasename>
Output it to a file (pg_dump -s <databasename> > filename) or grep out the lines in which you are interested (pg_dump -s <databasename> | grep "CREATE TABLE") is one way of getting a list of tables from the commandline.
As for the integer problem I think I'll recreate the table and use integer instead of string before it gets useable data entered. More searching thanks Roger
Max Pyziur pyz@brama.com
On Thu, 30 May 2013, Roger wrote:
Apologies for top post Thanks this is most helpful
One thing that I forgot to mention is tables that are in other schemas besides the public schema.
Personally, I don't build a database with tables in other schemas; but it does add a way of keeping tables organized hierarchically.
In the monitor, you can type \dn to get a list of schemas
Then to query a table in a particular schema SELECT * FROM <schemaname>.<tablename>
Alternatively, to find a lot of information in the monitor, you can type: \d *.*
And you'll get system tables, etc.
Roger
fyi,
Max Pyziur pyz@brama.com