search for: nextval

Displaying 20 results from an estimated 33 matches for "nextval".

2006 Feb 09
1
migration with PostgreSQL - function nextval does not exist
...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 migration has reported error: PGError: ERROR: function nextval(regclass) does not exist Funny part is that running "rake migrate" once again didn''t give this error again. It also has crashed, but becaus...
2006 Mar 01
7
Oracle Sequence & Rails
the compiler tell me it: invalid column name: INSERT INTO ago.prova_stats (cognome, nome, id, telefono) VALUES(''Medda'', ''Ivan'', :id, 70565611) where ago.prova_stats is the table used by me and that have only the columns ''cognome'',''nome'' and ''telefono''. My table hasn''t the column
2006 Feb 01
4
exclude a column in save!
Hi all, I have a column that peeks its value from a sequence (postgres) some times. Other times, I set it to a certain value. This column has a default value of "nextval(''the_sequence'')"... When I want that this column peeks the value from the sequence, I do this: obj = Mymodel.new obj.some_column1 = blah obj.some_column2 = blah obj.some_column3 = blah obj.save! but when looking at the logs, this creates a sql statement like this: INSERT...
2006 Jul 20
4
Help with Rails and postgres with sequence numbers (global?)
...ema: lxtest=# \d partsgroup Table "public.partsgroup" Column | Type | Modifiers ------------+-----------------------------+----------------------------------------- id | integer | default nextval((''id''::text)::regclass) partsgroup | text | itime | timestamp without time zone | default now() mtime | timestamp without time zone | Triggers: mtime_partsgroup BEFORE UPDATE ON partsgroup FOR EACH ROW EXECUTE PROCEDURE set_mtime() and log...
2011 Sep 18
9
Rails 3 and postgresql
...t 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 varying(40) | path | character varying(250) | in a method I have : id = params[:album].to_i @album = Pack.find id That is the sentence located using debugger. The answer in the browser: ActiveRecord::Statemen...
2009 Sep 07
11
autoincrement for non-id column
There is a table: execute (<<-SQL) CREATE TABLE "tasks" ( "id" serial primary key, "number" serial, "version" integer DEFAULT 0 NOT NULL, "latest_version" boolean DEFAULT ''t'' NOT NULL, "hidden" boolean DEFAULT ''f'' NOT NULL, "type" character varying (1) NOT
2008 May 19
2
x is not a number error??
.... The relevant database constraints are: Table "public.categories" Column | Type | Modifiers -------------------+--------- +-------------------------------------------------------------------------- id | integer | not null default nextval(''categories_id_seq''::regclass) parent_categoryid | integer | ... Indexes: "categories_parent_categoryid" btree (parent_categoryid) Foreign-key constraints: "$1" FOREIGN KEY (parent_categoryid) REFERENCES categories(id) ON DELETE CASCADE Thanks for an...
2006 May 03
4
default values
Hello, I''m working with a postgresql table CREATE TABLE elements ( id serial primary key, c1 text default f1(), ... cN text default fN() ); But if I use de lines @element = Element.new @element.save the values that element take are the nextval in the id field and nules in all the other fields. How can I get the defaults? (but without rewriting the funcitions f1,...,fN in the rails aplication, of course) Thaks -- Daniel H
2006 Feb 02
1
circular table refs in activerecord
...holding up a project. I have a *very* simple rails app with three tables, one of which is the users table: users: Column | Type | Modifiers ---------------+-----------------------------+----------------- id | integer | not null default nextval(''public.users_id_seq''::text) login | character varying(25) | not null password | character varying(150) | not null user_type | character varying(20) | not null first_name | character varying(30) | not null last_name | character varyin...
2006 Jan 05
1
recipes/categories to books/authors but listing doesn''t work
...t; <tr> <td><%= link_to book.title, :action => "show", :id => book.id %></td> <td><%= book.author.last_name %></td> </tr> <% end %> </table> authors table: id | integer | not null default nextval(''public.authors_id_seq''::text) last_name | character varying(20) | first_name | character varying(20) | other_name | character varying(20) | books table: id | integer | not null default nextval(''public.books_id_seq''::text) media |...
2010 Apr 14
3
PGError: duplicate key
I''m running a rails 2.3.5 / ruby 1.8.7 / postgresql 8.4.2 app and have just run into a curious problem. I have several tables that are initialized with data from csv files and I''ve noticed that, when I try to add new data to any of these tables via Table.new I get a PGError on duplicate key. For example: MIGRATION: class CreateNumbers < ActiveRecord::Migration def self.up
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
2006 Mar 21
7
Nuube Sequence problem
...RoR thinks that it is 809. My log file (below) shows that just before the insert it grabs the next sequence value. I dont think it should do that. This causes problems further down the line when trying to access the Person object. Development Log file : "SQL (0.016000) select people_seq.nextval id from dual Person Create (0.015000) INSERT INTO people (title, weight, mothers_maiden_name, shoe_size, middlename, person_type, username, firstname, height, person_id, createdby, expired, name_string, surname) VALUES(''Mr'', ''100'', '''', 10,...
2006 Oct 30
2
It this possible: finder_sql-like behavior for belongs_to?
...Table "public.gate_clock_employees " Column | Type | Modifiers ------------+------------------------+------------------------------------------------------------------- id | integer | not null default nextval(''gate_clock_employees_id_seq''::regclass) tagnum | integer | pin | character varying(255) | lastname | character varying(255) | firstname | character varying(255) | mi | character varying(255) | dept | character varying(255) | title...
2006 Aug 16
14
Migrations: only one table per migration file?
Hi all I have a new migration file created that adds some tables and fills one with some data: create_table :sound_styles do |t| t.column :name, :string, :null => false end create_table :show_types do |t| t.column :name, :string, :null => false end create_table :countries do |t| t.column :name, :string, :null => false end ActionView::Helpers::FormOptionsHelper::COUNTRIES.each
2010 Jul 21
1
asterisk realtime SIP configuration
...re-connect => yes *Database table in postgres "sip" :* Column | Type | Modifiers ----------------+------------------------+-------------------------------------------------- id | integer | not null default nextval('sip_id_seq'::regclass) name | character varying(80) | not null accountcode | character varying(20) | amaflags | character varying(7) | callgroup | character varying(10) | callerid | character varying(80) | directmedia | character varying(3) |...
2005 Mar 09
6
auto increment id
looking at the unit tests of activerecord leads me to think the db is completely responsible for auto-incrementing the id field and rails does no magic here. can someone confirm that this is a true statement? that being the case - what is the preferred way to write database agnostic sql for one''s schema since each of the dbs has slightly different syntax for this functionality... does
2007 Jan 23
7
ActiveRecord requires sequence numbers in Oracle join table
I am mapping ActiveRecord classes to an existing Oracle database. This means I cannot change the database schema to fit ActiveRecord conventions. Predictably, I have gotten into trouble: I have several join tables that do not have a primary key column, and therefore no number sequence defined. ActiveRecord insists on requiring a sequence, and gets unhappy when there is none to find. Is there a
2006 Jan 22
5
has_one not working as expected?
...Table "public.manufacturers" Column | Type | Modifiers --------+------------------------+--------------------------------------------------------------- id | integer | not null default nextval(''public.manufacturers_id_seq''::text) name | character varying(255) | not null Indexes: "manufacturers_pkey" primary key, btree (id) photo_dev=> \d filters Table "public.filters" Column | Type...
2010 Feb 24
4
"Sequence does not exist" for joined model
...t;review"=>{"irb_id"=>["35540"]}, "action"=>"create_association", "id"=>"1", "controller"=>"reviews"} ActiveRecord::StatementInvalid (OCIError: ORA-02289: sequence does not exist: SELECT reviews_seq.NEXTVAL id FROM dual): C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.3/lib/active_record/connection_adapters/oracle_enhanced_adapter.rb:1359:in `log'' C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-oracle_enhanced-adapter-1.2.3/lib/active_record/connection_adapters/oracle...