similar to: postgresql sequence and migrations

Displaying 20 results from an estimated 5000 matches similar to: "postgresql sequence and migrations"

2006 Apr 30
16
postgresql duplicate key violates unique constraint
I have a weird problem with creating a new record when using PostgreSQL. From inside script/console ... >> entity = Entity.new >> entity.first_name = "Foo" >> entity.last_name = "bar" >> entity.save Throws an exception due to the following SQL error: duplicate key violates unique constraint. The application was working fine before and suddenly
2005 Dec 22
2
nonstandard postgresql sequence names
I''m working with a legacy postgresql database where the names of tables, columns, etc., do not usually follow Rails conventions. I''ve been able to work around it for the most part, but I ran into this: I have the following test: require File.dirname(__FILE__) + ''/../test_helper'' class SponsorTest < Test::Unit::TestCase self.use_transactional_fixtures =
2008 Sep 23
3
Finding distinct months using find_by_sql
Hello, I''m wondering if someone might be able to offer me a solution to the following problem that has so far stumped me. I''m trying to get the distinct months (and years) from a date field to display as a list in a view. For example, there might be a number of records stored with dates in the table ''headlines'': name date record1 21-09-2008 record2
2011 Sep 18
9
Rails 3 and postgresql
I have a simple project created around a very, very simple database: one main table packs with just three rows Column | Type | Modifiers --------+-----------------------------+---------------------------------------------------- id | integer | not null default nextval(''packs_id_seq''::regclass) nombre | character
2004 Dec 20
1
Fw: pbx.c:1279 pbx_extension_helper: No application 'SetVal' for extension (c819, 1, 1)
I have added a sip user in sip.conf. user name is 819,context is c819. and I have added the follows rows in extension.conf. like [c819] exten => 1,1,Answer exten => 1,2,SetVal(voicemail=${exten}) exten => 1,3,Dial(SIP/${voicemail}) It appear a error message(pbx.c:1279 pbx_extension_helper: No application 'SetVal' for extension (c819, 1, 2)) when i dial 1 from 819. The
2006 Jul 10
2
Problem with migrations, postgresql, AWDwR
Hi all, Rails 1.1.4 Rake 0.7.1 PostgreSQL 8.1.4 Windows XP Pro I checked for errata on pragmaticprogrammer.com, but didn''t see any explicit mention of this issue. I''m going over the depot example in AWDwR, 2nd ed, and I can''t get the migration to work on p. 82. Specifically, the AddTestData example (with reduced description text to save my fingers some typing):
2012 Jan 22
4
undefined method `gsub!' for 2012-01-22 17:00:00 -0500..2012-01-23 00:00:00 -0500:Chronic::Span
Hey all, I am getting this error: NoMethodError (undefined method `gsub!'' for 2012-01-22 17:00:00 -0500..2012-01-23 00:00:00 -0500:Chronic::Span): in this code: date_range = Chronic.parse(the_date, :guess => false) reports.sum_distance_by_date(date_range).each do |d| u[:m] << d end def
2006 Jan 25
3
Resetting sequences in unit tests with pg
Hi all, Rails 1.0 Postgresql 8.1 Ruby 1.8.4 Is there a way to reset sequences in unit tests when loading fixture data? I came across mention of a "Fixtures.reset_sequences method here: http://api.rubyonrails.com/files/vendor/rails/activerecord/CHANGELOG.html However, when I tried to call Fixtures.reset_sequences in the setup method, I got a NoMethodError. Any ideas? Thanks, Dan
2006 Apr 18
6
Postgresql and ActiveRecords problems
Hi all. I have a problem with postgresql PK columns and ActiveRecord. The error is: PGError: ERROR: null value in column "item_id" violates not-null. Ok, it''s wrong to insert NULL into PK columns, but rails doing it. How to fix? So sad..
2006 Apr 03
4
How to fake composite primary keys?
I know ActiveRecord doesn''t support composite primary keys, but I need to use one, and I need it ASAP. I don''t need any composite foreign keys, luckily; what I have is a table that stores old versions of rows in another table, so the composite key is an id + date stamp. Would someone tell me a hack I can use to support this? -- View this message in context:
2006 Apr 03
2
problems testing on 1.1 and postgresql
Hi, I get errors doing this: 1) createdb myapp_test 2) rake db:test:clone_structure 3) rake test:units rake aborted! PGError: ERROR: relation "matches" already exists I''m using the :sql schema format because there are some problems with postgres and the :ruby schema format config.active_record.schema_format = :sql It seems rake test:units is trying to create the tables
2011 Feb 17
4
PGError: ERROR: relation "instructions" does not exist
HI, I got this error when i am testing my rails application. I dont have the table named ''instructions''. But it shows a error like "ERROR: relation "instructions" does not exist". Totally, I got same error for 64 tests as 64 errors. I am using rails 3.0, Ruby 1.9.2, Netbeans 6.8. PS: I didnt creat Instruction manual for rails application. *Error:
2006 Feb 09
1
migration with PostgreSQL - function nextval does not exist
This might be a problem with postgresql, but I''m not sure. In a migration I have renamed a table so I wanted to rename a sequencer as well. It looks like: execute "ALTER TABLE global_vacations_id_seq RENAME TO vacations_id_seq;" execute "ALTER TABLE vacations ALTER COLUMN id SET DEFAULT nextval(''vacations_id_seq''::regclass);" But the process of
2006 Sep 20
3
Can this 1337 PostgreSQL Subquery Union be done in AR?
Just wondering if it''s possible, without resorting to find_by_sql. select id, title, datetime, type from ( select id, title, added as datetime, ''items'' as type from items union select id, headline as title, datetime, ''news'' as type from news ) as items order by datetime desc limit 50; I''m also curious if it''s possible in MySQL. Joe
2006 Apr 25
3
rake test:units fails on Postgresql due to nil
Following the directions in: http://www.xml.com/pub/a/2006/04/19/rest-on-rails.html?page=2 I get through the: rake db:migrate With the tables created properly but then when I run the: rake test:units I get a failure: ActiveRecord::StatementInvalid: RuntimeError: ERROR C23502 Mnull value in column "title" violates not-null constraint FexecMain.c L1750
2008 Nov 04
9
RSpec and PostgreSQL not playing nicely together
Here is a very simple spec: -- require File.expand_path(File.dirname(__FILE__) + ''/../spec_helper'') describe Product, "The Product model" do describe "When a new blank product object gets created" do before(:each) do @product = Product.new end it "should not be valid" do @product.should_not be_valid
2010 Dec 12
1
PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xa0
Hello, my app is reading emails with attachments and inserting the Email message into the database to be sent to delayed job for processing. When inserting an email with attachments into the database, I get the following error: PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xa0 Has anyone seen this before? There doesn''t seem to be much rails related via
2006 Jul 17
5
quantic phenomena in migrations
I have an application with 15 migrations under version control. In a Mac and and in a Windows, a rake migrate from scratch runs them all just fine. But in a different Windows machine rake migrate stops after migration 3 for no apparent reason. --trace seems normal. No error is reported. Both Windows are XP SP2. They all have the same svn revision and Rails-related software, database is
2007 Dec 12
2
possible bug in eager loading
Hello, @users = User.find(:all, :include => {:user_data => :user_data_field}, :order => "username = ''someone-oHC15RC7JGTNLxjTenLetw@public.gmane.org'' desc", :limit => 50) This produces: User Load IDs For Limited Eager Loading (74.648762) SELECT * FROM (SELECT DISTINCT ON (users.id) users.id, username AS alias_0 FROM users LEFT OUTER JOIN
2006 Mar 02
1
PostgreSQL function in an insert statement
Hi there, I wont insert a picture in a PostgrSQL-DB via the function lo_import. Therfore I modify the value of an ''oid'' column. @measurepoint = Measurepoint.new(params[:measurepoint]) @measurepoint.measurepoint_background = "lo_import(''#{@params[''measurepoint''][''measurepoint_background'']'')" @measurepoint.save The