Re: [sqlite] ALTER TABLE ADD COLUMN

2019-10-23 Thread x
Sent: Wednesday, October 23, 2019 2:09:19 PM To: SQLite mailing list Subject: Re: [sqlite] ALTER TABLE ADD COLUMN Wednesday, October 23, 2019, 1:53:10 PM, x wrote: > From the documentation > “A record might have fewer values than the number of columns in the > corresponding table. This ca

Re: [sqlite] ALTER TABLE ADD COLUMN

2019-10-23 Thread David Raymond
On disk a record basically looks like: Here are 5 values: value1, value2, value3, value4, value5 If your query is looking for the 6th, 7th or 8th field and the record on the disk only has 5, then it goes " I guess they should be the default values for the missing fields." What that means is that

Re: [sqlite] ALTER TABLE ADD COLUMN

2019-10-23 Thread Simon Slavin
On 23 Oct 2019, at 1:53pm, x wrote: > Suppose you have a table with say 5 columns that are almost always the > default value (probably zero or null). Does the above suggest you should make > them the last 5 columns in the table as the last n columns that are the > default value won’t take up s

Re: [sqlite] ALTER TABLE ADD COLUMN

2019-10-23 Thread Graham Holden
Wednesday, October 23, 2019, 1:53:10 PM, x wrote: > From the documentation > “A record might have fewer values than the number of columns in the > corresponding table. This can happen, for example, after an ALTER TABLE ... > ADD COLUMN SQL statement has increased the number of > columns in the

Re: [sqlite] ALTER TABLE .. ADD COLUMN .. IF NOT EXISTS ..?

2014-12-16 Thread Nico Williams
On Tue, Dec 16, 2014 at 11:40:22PM +, Simon Slavin wrote: > If 'ALTER TABLE ... ADD COLUMN ...' fails it fails harmlessly, with But it doesn't fail so harmlessly: $ sqlite3 db 'alter table toy add column foo text; select 5;' || echo fail SQL Error: duplicate column name: foo fail $ Note tha

Re: [sqlite] ALTER TABLE .. ADD COLUMN .. IF NOT EXISTS ..?

2014-12-16 Thread Simon Slavin
On 16 Dec 2014, at 10:40pm, Nico Williams wrote: > I have a habit of putting schema definitions in a file that's always > safe to read and execute against a DB connection. This means that I > DROP some things IF EXISTS and CREATE all things IF NOT EXISTS. > > But if I have to ALTER TABLE... th

Re: [sqlite] alter table add column

2011-05-31 Thread Simon Slavin
On 31 May 2011, at 5:09pm, Fabio Spadaro wrote: > Step 1: alter table pippo rename to fabio -> ok > step 2: insert into fabio (field1) values ​​('1 ') -> ko > OperationalError: no such table main.pippo How does step 2 know the name 'pippo' ? You don't seem to supply it in the command. Sim

Re: [sqlite] alter table add column

2011-05-31 Thread Stephan Beal
On Tue, May 31, 2011 at 6:09 PM, Fabio Spadaro wrote: > To recap: > Step 1: alter table pippo rename to fabio -> ok > step 2: insert into fabio (field1) values ('1 ') -> ko > OperationalError: no such table main.pippo > Step 3: alter table add column fabio field2 integer null -> ok > result: >

Re: [sqlite] alter table add column

2011-05-31 Thread Fabio Spadaro
Hi 2011/5/31 Stephan Beal > On Tue, May 31, 2011 at 5:11 PM, Fabio Spadaro >wrote: > > > "Alter table add column" command drop data from table. > > Can you keep the data or should I store the data before the alter and > then > > put > > them in the table? > > > > http://www.sqlite.org/lang_alte

Re: [sqlite] alter table add column

2011-05-31 Thread Stephan Beal
On Tue, May 31, 2011 at 5:11 PM, Fabio Spadaro wrote: > "Alter table add column" command drop data from table. > Can you keep the data or should I store the data before the alter and then > put > them in the table? > http://www.sqlite.org/lang_altertable.html says: "The execution time of the AL

Re: [sqlite] alter table add column

2011-05-31 Thread Mr. Puneet Kishor
On May 31, 2011, at 10:11 AM, Fabio Spadaro wrote: > "Alter table add column" command drop data from table. > Can you keep the data or should I store the data before the alter and then put > them in the table? ALTER TABLE ADD COLUMN does not drop data from the table.

Re: [sqlite] ALTER TABLE ADD COLUMN - strange behaviour....Mac OSX

2007-06-03 Thread Nuno Lucas
On 6/3/07, Mark Gilbert <[EMAIL PROTECTED]> wrote: Anyone have *any* idea what is happening ? I don't know nothing about MacOS, but you may want to check the result of sqlite3_close. It's possible it's not closing the database [1]. Regards, ~Nuno Lucas [1] http://www.sqlite.org/capi3ref.html#

Re: [sqlite] ALTER TABLE ... ADD COLUMN crashes with too many columns

2005-03-29 Thread D. Richard Hipp
On Tue, 2005-03-29 at 03:13 -0800, Andy Lutomirski wrote: > I can crash sqlite3 like this: > > % cat test.sql > create table a (id INTEGER PRIMARY KEY); > alter table a add column f1 TEXT; > alter table a add column f2 TEXT; > alter table a add column f3 TEXT; > alter table a add column f4 TEXT; >