Recently I installed the latest version of Ur/Web (20150412 release) on a new machine (using Postgres 9.4.1 on Debian 8 Jessie running on Amazon AWS EC2), and I am trying to run the Crud1 demo here:
http://www.impredicative.com/ur/demo/crud1.html When I do: ./crud1.exe I am getting the error: Fatal initialization error: Table 'uw_crud1_t1' does not exist. This seems strange, because I had previously been able to run this example using the earlier version of Ur/Web on another Debian machine using Postgres a few months ago. Since I am using Postgres, I'm not sure if the discussions at these links (regarding MySQL) are applicable: http://www.impredicative.com/pipermail/ur/2015-January/001834.html http://www.impredicative.com/pipermail/ur/2015-April/001929.html I am using the following files from the Crud1 demo (with a slight modification to file crud1.urp): admin:~/wrk/crud1$ ls -l total 60 -rwxr-xr-x 1 admin admin 35088 May 16 03:45 crud1.exe -rw-r--r-- 1 admin admin 290 May 16 03:45 crud1.sql -rw-r--r-- 1 admin admin 460 May 16 02:17 crud1.ur -rw-r--r-- 1 admin admin 48 May 16 02:19 crud1.urp -rw-r--r-- 1 admin admin 6148 May 16 02:17 crud.ur -rw-r--r-- 1 admin admin 953 May 16 02:16 crud.urs I had changed the file crud1.urp, so that it would now read as follows (I changed both occurrences of 'test' to 'crud1'): admin:~/wrk/crud1$ cat crud1.urp database dbname=crud1 sql crud1.sql crud crud1 To compile, I used the command: admin:~/wrk/crud1$ urweb -dbms postgres -db "host=localhost port=5432 user=admin password=xxxxxxxx dbname=crud1" crud1 Here is generated file crud1.sql: admin:~/wrk/crud1$ cat crud1.sql CREATE TABLE uw_Crud1_t1(uw_id int8 NOT NULL, uw_a int8 NOT NULL, uw_b text NOT NULL, uw_c float8 NOT NULL, uw_d bool NOT NULL,PRIMARY KEY (uw_id) ); CREATE SEQUENCE uw_Crud1_seq; === I am logged in as user 'admin' on this machine (Debian 8 Jessie running on Amazon EC2). I did the following to switch to user 'postgres' and create the database 'crud1' and the (Postgres) user 'admin' and grant all privileges on database 'crud1' to user 'admin': admin:~/wrk/crud1$ sudo -i root$ su - postgres postgres:~$ createdb crud1 postgres:~$ psql -f /home/admin/wrk/crud1/crud1.sql crud1 postgres:~$ psql psql (9.4.1) Type "help" for help. postgres=# create user admin with password 'xxxxxxxx'; postgres=# grant all on database crud1 to admin; The following command shows that user 'admin' appears to have "access privileges" on database 'crud1': postgres=# \l Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- crud1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres + | | | | | postgres=CTc/postgres+ | | | | | admin=CTc/postgres postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres (4 rows) The following shows that table 'uw_crud1_t1' *does* exist: postgres=# \c crud1 crud1=# \d List of relations Schema | Name | Type | Owner --------+--------------+----------+---------- public | uw_crud1_seq | sequence | postgres public | uw_crud1_t1 | table | postgres (2 rows) crud1=# select * from uw_crud1_t1; uw_id | uw_a | uw_b | uw_c | uw_d -------+------+------+------+------ (0 rows) So it appears that: - the database 'crud1' exists - the user 'admin' with password 'xxxxxxxx' exists and has all privileges on database 'crud1' - the table 'uw_crud1_t1' exists - and its name is all lowercase Note: As shown in the results of doing 'cat crud1.sql' above, the file crud1.sql did use an uppercase "C" in the table name: CREATE TABLE uw_Crud1_t1(uw_id int8 NOT NULL, uw_a int8 NOT NULL, uw_b text NOT NULL, uw_c float8 NOT NULL, uw_d bool NOT NULL,PRIMARY KEY (uw_id) ); However, according to results of doing '\l' in psql above, the table name ended up being all lowercase for some reason. As a final attempt, I did the following in psql, to grant all privileges on database 'crud1' to everyone (not just to user 'admin'): postgres=# grant all on database crud1 to public; Then I recompiled: admin:~/wrk/crud1$ urweb -dbms postgres -db "host=localhost port=5432 user=admin password=pgasdfASDF123 dbname=crud1" crud1 But I still got the same error: admin:~/wrk/crud1$ ./crud1.exe Fatal initialization error: Table 'uw_crud1_t1' does not exist. === I also tried doing this same test with the demo 'Sql': http://www.impredicative.com/ur/demo/sql.html This time I didn't change anything in the .urp, .urs and .ur files - using them exactly as-is. I got the same results: admin:~/wrk/sql$ urweb -dbms postgres -db "host=localhost port=5432 user=admin password=xxxxxxxx dbname=test" sql admin:~/wrk/sql$ sudo -i root$ su - postgres postgres:/home/admin/wrk/sql$ createdb test postgres:/home/admin/wrk/sql$ psql -f /home/admin/wrk/sql/sql.sql test CREATE TABLE postgres:/home/admin/wrk/sql$ psql psql (9.4.1) Type "help" for help. postgres=# grant all on database test to admin; GRANT postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- crud1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =CTc/postgres + | | | | | postgres=CTc/postgres+ | | | | | admin=CTc/postgres postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres test | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres + | | | | | postgres=CTc/postgres+ | | | | | admin=CTc/postgres (5 rows) postgres=# admin:~/wrk/sql$ ./sql.exe Fatal initialization error: Table 'uw_sql_t' does not exist. admin:~/wrk/sql$ cat sql.sql CREATE TABLE uw_Sql_t(uw_a int8 NOT NULL, uw_b float8 NOT NULL, uw_c text NOT NULL, uw_d bool NOT NULL, PRIMARY KEY (uw_a) ); === One thing that seems strange is that the program outputs an error message using *all-lowercase* in the table name: Fatal initialization error: Table 'uw_sql_t' does not exist. But the generated .sql file uses *camelcase* in the table name: CREATE TABLE uw_Sql_t(uw_a int8 NOT NULL, uw_b float8 NOT NULL, uw_c text NOT NULL, uw_d bool NOT NULL, PRIMARY KEY (uw_a) ); The only guesses I have about what might be going wrong would be the following - but I'm not sure: - The urweb compiler may be using the wrong case (camelcase or lowercase) somewhere? - There may be something wrong with the privileges or the with Postgres password for the user 'admin'? - There may be some confusion between the *Postgres* user 'admin' and the *Debian* user 'admin'? Thanks for any help! ###
_______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
