All of the tutorials and the Agile book use MySQL and I''ve got that working. I am now trying to use PostgreSQL and can''t seem to get going. Is my problem the db setup in postgresql? I have installed postgres-pr The error message when I try to access http://localhost:3000/clients when using PostgreSQL (MySQL works fine) ActiveRecord::StatementInvalid (RuntimeError: ERROR C42501 Mpermission denied for relation clients Faclchk.c L987 Raclcheck_error: SELECT COUNT(*) FROM clients ): /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in `log'' /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/postgresql_adapter.rb:137:in `execute'' *** there''s more but I didn''t think I needed to *** Postgres setup... CREATE TABLE clients ( id serial primary key NOT NULL, first_name character varying(25) NOT NULL, middle_initial character varying(1) NOT NULL, last_name character varying(25) NOT NULL, gov_id character varying(18) NOT NULL, dob date ); MySQL setup CREATE TABLE `clients` ( `id` int(8) NOT NULL auto_increment, `first_name` varchar(25) NOT NULL default '''', `middle_initial` char(1) NOT NULL default '''', `last_name` varchar(25) NOT NULL default '''', `gov_id` varchar(18) default NULL, `dob` date default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
On Jan 19, 2006, at 10:39 PM, Craig White wrote:> Is my problem the db setup in postgresql?I think so...> ActiveRecord::StatementInvalid (RuntimeError: > ERROR C42501 Mpermission denied for relationWell, that''s pretty clear... What user did you login as to create the tables? The same user you configured into Rails? Did you give a GRANT command of any sort?> CREATE TABLE clients ( > id serial primary key NOT NULL, > first_name character varying(25) NOT NULL, > middle_initial character varying(1) NOT NULL, > last_name character varying(25) NOT NULL, > gov_id character varying(18) NOT NULL, > dob date > );I don''t think it''s related to the error, but gov_id should be an INT4, if you''re planning on using Rails'' conventions. And, if you''re not planning on using Rails'' conventions at the beginning of a project, you''re making a mistake. P.S. Check out the migrations video on the RoR website. I held out for a while (avoiding learning yet another brand new concept) but I just finished converting my schema to an initial migration and it''s very, very cool.
On Jan 19, 2006, at 10:39 PM, Craig White wrote:> Is my problem the db setup in postgresql?I think so...> ActiveRecord::StatementInvalid (RuntimeError: > ERROR C42501 Mpermission denied for relationWell, that''s pretty clear... What user did you login as to create the tables? The same user you configured into Rails? Did you give a GRANT command of any sort?> CREATE TABLE clients ( > id serial primary key NOT NULL, > first_name character varying(25) NOT NULL, > middle_initial character varying(1) NOT NULL, > last_name character varying(25) NOT NULL, > gov_id character varying(18) NOT NULL, > dob date > );I don''t think it''s related to the error, but gov_id should be an INT4, if you''re planning on using Rails'' conventions. And, if you''re not planning on using Rails'' conventions at the beginning of a project, you''re making a mistake. P.S. Check out the migrations video on the RoR website. I held out for a while (avoiding learning yet another brand new concept) but I just finished converting my schema to an initial migration and it''s very, very cool.
On Thu, 2006-01-19 at 23:00 -0500, Tom Mornini wrote:> On Jan 19, 2006, at 10:39 PM, Craig White wrote: > > > Is my problem the db setup in postgresql? > > I think so... > > > ActiveRecord::StatementInvalid (RuntimeError: > > ERROR C42501 Mpermission denied for relation > > Well, that''s pretty clear... > > What user did you login as to create the tables? The > same user you configured into Rails?---- duh - I would swear that I checked this out many times but it turns out that this must be the issue as it worked when I set the user to postgres ----> > Did you give a GRANT command of any sort?---- probably during many of the create/drop cycles and didn''t this last time. Obviously this will be the solution to my problem. Thanks ----> > > CREATE TABLE clients ( > > id serial primary key NOT NULL, > > first_name character varying(25) NOT NULL, > > middle_initial character varying(1) NOT NULL, > > last_name character varying(25) NOT NULL, > > gov_id character varying(18) NOT NULL, > > dob date > > ); > > I don''t think it''s related to the error, but gov_id > should be an INT4, if you''re planning on using Rails'' > conventions.---- I lacked the right term for it when I was creating it - it''s not a social security number and not really a number at all, but sometimes letters and numbers which I see as a text string. ----> > And, if you''re not planning on using Rails'' > conventions at the beginning of a project, you''re > making a mistake. > > P.S. Check out the migrations video on the RoR > website. I held out for a while (avoiding > learning yet another brand new concept) but > I just finished converting my schema to an > initial migration and it''s very, very cool.---- I''m starting from scratch and in the meantime plowing through the Agile book and haven''t gotten to migrations yet but I did see the video and thought it cool. Obviously I am going to have a lot of iterations before I get any real work done but I wanted to start playing with it since that is the only way I will learn and all of the demonstrations use MySQL and I want to get to PostgreSQL and away from MySQL and you have enabled me to do that...thanks Craig