Further to postgres on Rails in Fedora 18 but OT

Max Pyziur pyz at brama.com
Thu May 30 02:17:57 UTC 2013


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 at brama.com


More information about the users mailing list