similar to: Migrate column from text to binary (PostgreSQL)

Displaying 20 results from an estimated 20000 matches similar to: "Migrate column from text to binary (PostgreSQL)"

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 Jan 18
1
Rails and PostgreSQL bytea
Hi! I''m trying to insert binary data into a PostgreSQL database where the field is of type ''bytea''. This works fine if a do Base64 encoding but I just want to do character escaping. How do I do this????. What I get is this: ActiveRecord::StatementInvalid in Init_test#save_file ArgumentError: Invalid Ruby/cstring: INSERT INTO
2006 Jul 18
2
Scaffold a Plural table w/ No Pluralization in environment
Hi guys, I have a situation here. I have my project set to no pluralization due to legacy tables in environment.rb. Now, I have some new tables which I''m starting to pluralize. When I do a generate a scaffold to this new table: script/generate scaffold my_tables table it seems to work out fine for certain sections like http://mysite.com/railsapp/new (which also inserts properly to
2012 May 25
2
Typecast values on change_column for postgresql
Hello, Currently if you have a string column that have only number values (think a year column using string by mistake) and you want to change to integer, you can''t. If you apply this monkey-patch will be possible: https://gist.github.com/1393441 Note: if some value can''t be casted by postgresql (if have a letter for example), the migration will fail as expected. I think
2006 Jul 05
1
ActiveRecord / PostgreSQL Performance Issue
I''m currently using ruby-postgres (the compiled interface to PostgreSQL), and I''m seeing a huge performance hit with larger :binary fields in ActiveRecord subclasses owing, it appears, to the use of the bytea field type and the fact that using that datatype necessitates an in-memory "unescape" conversion. The best I can tell from looking at the Postgres Active
2006 Apr 10
1
Add Column After Column in Migrations
Adding a column to a table just places the column at the end, but I like to keep related columns together. Is there a way to specify where the column is added in a table with migrations? For example, in MySQL you can do: ALTER TABLE my_table ADD COLUMN new_column INT AFTER other_column I was hoping migrations would support something like this: add_column :my_table, :new_column, :integer,
2006 Jul 01
1
Changing column to NOT NULL with migration silently failing.
Hi I''ve created a migration called make_customer_type_id_not_null_for_customers. The migration .rb file looks like this: class MakeCustomerTypeIdNotNullForCustomers < ActiveRecord::Migration def self.up change_column(:customers, :customer_type_id, :integer, { :null => false }) end def self.down change_column(:customers, :customer_type_id, :integer, { :null =>
2006 Jun 15
8
postgresql sequence and migrations
I have a specific need to ''fixate'' my ''roles'' table sequence when migrating. at migration #4, I have 28 records in my roles tables and I can manually reset the roles_id_seq but it stands to reason that since I am doing everything else in the migration, I might as well reset the sequence there too. so I tried this in my migration file... execute
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
2008 Nov 25
1
migration error, mysql, change column limit
Hmm, one of my migrations have stopped working on #down. It still works on #up. (It''s also possible that I never tested it for #down before, and it never worked, heh.) I can''t figure out why not. Pretty simple. class WidenRequestParams < ActiveRecord::Migration def self.up change_column :requests, :params, :string, :limit => 2048 end def self.down
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
2007 Mar 19
0
PGError "unknown column" on polymorphic association column
Hi all ! This is very strange. I am attempting to get my application running on PostgreSQL (from MySQL), and I get this error: ActiveRecord::StatementInvalid: PGError: ERREUR: la colonne «Party» n'existe pas : SELECT * FROM contact_routes WHERE (routable_type = "Party" AND routable_id = 1000013) ORDER BY position DESC LIMIT 1
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 Oct 30
2
pg_escape_bytea / pg_unescape_bytea (php) alternative in Rails?
Is there a built-in function that handles the problem of bitstreams in postgresql? The problem occurs when the stream contains for example the " character. Postgres will think that the string has ended with that character. Is there a function that changes all such characters into "\[ASCII-number]"? And the other way around when getting the stream back from the database? References:
2006 Nov 04
0
PostgreSQL ActiveRecord default localized date assigned in test env
Hi, today I''ve configured an XUbuntu as workstation (ok I know...). Using the following packages to make Rails interact with Postgres: ii libpgsql-ruby1.8 0.7.1-7 ii postgresql-8.1 8.1.4-0ubuntu1 using rails 1.1.6 from gems. The problem came up just on the testing environment, when I save a model I get a: ActiveRecord::StatementInvalid:
2006 Jul 01
0
activerecord generating wrong syntax with postgresql
I''m using activerecord outside of rails and find_first generates sql that postgresql doesnt'' like. This is rails 1.1.4, with everything up to date via "gem update". This is the command line: ruby -rrubygems seca -c ../etc/seca.cnf cert --export 1 --format pkcs12 --key root.key >root.pfx This is the error: (PGError: ERROR: argument of WHERE must be type
2009 Apr 27
0
Encoding Problem / mod_rails / passenger / Postgresql 8.3
Hi, when I use mod_rails/passenger with apache2 on linux instead of webbrick for our application, then it stops working with certain browsers like the ie, and konqueror but still works with firefox. I get the following error message: ActionView::TemplateError (PGError: ERROR: invalid byte sequence for encoding "UTF8": 0xad HINT: This error can also happen if the byte sequence does
2007 Feb 19
0
Invalid SQL generated with PostgreSQL 8.2.3
Hey, Using Ruby 1.8.5, postgres-pr-0.4.0, activerecord-1.15.2, Rails 1.2.2 and PostgreSQL 8.2.3. I''m following the O''Reilly book "Ruby on Rails", so you can tell I know precious little of what I''m doing ;-) Well, I''ve created some models, and was working through examples, and executed the following from a console: >> show = Slideshow.find 1
2006 Feb 23
1
PostgreSQL CASCADE not copied to test db
When the unit test harness creates a test database from the development database, the ON DELETE CASCADE constraints I have on my foreign keys are not copied into the test database. (I can tell by looking at db/development_structure.sql.) That means the fixtures can''t load/unload from the test database properly. In other words, all my tests fail with the same error message:
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 =