[sqlite] alter table

2020-02-17 Thread Thomas Kurz
I'd just like to kindly ask whether there are any new plans for a full ALTER TABLE support? ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

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. Th

Re: [sqlite] ALTER TABLE ADD COLUMN

2019-10-23 Thread David Raymond
space. I think it's SQLITE_ENABLE_NULL_TRIM, which is disabled by default. -Original Message- From: sqlite-users On Behalf Of x Sent: Wednesday, October 23, 2019 8:53 AM To: sqlite-users@mailinglists.sqlite.org Subject: [sqlite] ALTER TABLE ADD COLUMN From the documentation “A record might ha

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

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

[sqlite] ALTER TABLE ADD COLUMN

2019-10-23 Thread x
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 table schema without modifying preexisting rows in the

Re: [sqlite] ALTER TABLE fails when renaming an INTEGER PRIMARY KEY column in a WITHOUT ROWID table

2019-05-06 Thread Manuel Rigger
Great, thanks a lot, Dan! Best, Manuel On Mon, May 6, 2019 at 6:18 PM Dan Kennedy wrote: > > On 6/5/62 16:42, Manuel Rigger wrote: > > Hi everyone, > > > > the following example fails with an error "no such column: c0": > > > > CREATE TABLE t0 (c0 INTEGER, PRIMARY KEY (c0)) WITHOUT ROWID; > >

Re: [sqlite] ALTER TABLE fails when renaming an INTEGER PRIMARY KEY column in a WITHOUT ROWID table

2019-05-06 Thread Dan Kennedy
On 6/5/62 16:42, Manuel Rigger wrote: Hi everyone, the following example fails with an error "no such column: c0": CREATE TABLE t0 (c0 INTEGER, PRIMARY KEY (c0)) WITHOUT ROWID; ALTER TABLE t0 RENAME COLUMN c0 TO c1; Thanks again for the bug reports. This one is now fixed here:

[sqlite] ALTER TABLE fails when renaming an INTEGER PRIMARY KEY column in a WITHOUT ROWID table

2019-05-06 Thread Manuel Rigger
Hi everyone, the following example fails with an error "no such column: c0": CREATE TABLE t0 (c0 INTEGER, PRIMARY KEY (c0)) WITHOUT ROWID; ALTER TABLE t0 RENAME COLUMN c0 TO c1; However, specifying c0 as the PRIMARY KEY in the column definition rather than in a table constraint seems to work:

Re: [sqlite] ALTER TABLE fails when there is an INSTEAD-OF trigger of a VIEW

2018-12-26 Thread Mark Johnson
Am Do., 27. Dez. 2018 um 02:53 Uhr schrieb Mark Johnson < mj10...@googlemail.com>: > (summery of the last messages that were sent as email) > > >> Please add the list of column names after the view name: > >> CREATE VIEW middle_earth_admin_general(a,b,c,e) AS ... > >> I have a note to improve the

Re: [sqlite] ALTER TABLE fails when there is an INSTEAD-OF trigger of a VIEW

2018-12-26 Thread Mark Johnson
(summery of the last messages that were sent as email) >> Please add the list of column names after the view name: >> CREATE VIEW middle_earth_admin_general(a,b,c,e) AS ... >> I have a note to improve the documentation about this point. So would the following be true: To insure that a constant,

Re: [sqlite] ALTER TABLE fails when there is an INSTEAD-OF trigger of a VIEW

2018-12-26 Thread Richard Hipp
On 12/26/18, Mark Johnson wrote: > Am Do., 20. Dez. 2018 um 16:34 Uhr schrieb Mark Johnson < > mj10...@googlemail.com>: > >> Based on ticket >> >> https://www.sqlite.org/src/tktview?name=43ddc85a63 >> >> >> >> However, the column count is not correct. >> In my case 2 columns are missing: which

Re: [sqlite] ALTER TABLE fails when there is an INSTEAD-OF trigger of a VIEW

2018-12-26 Thread Mark Johnson
Am Do., 20. Dez. 2018 um 16:34 Uhr schrieb Mark Johnson < mj10...@googlemail.com>: > Based on ticket > > https://www.sqlite.org/src/tktview?name=43ddc85a63 > > > > However, the column count is not correct. > In my case 2 columns are missing: which should be 19. > After a fresh look at this today,

[sqlite] ALTER TABLE fails when there is an INSTEAD-OF trigger of a VIEW

2018-12-20 Thread Mark Johnson
Based on ticket https://www.sqlite.org/src/tktview?name=43ddc85a63 --- During work for spatialite, I have also run into this problem using version 3.25.3. Today I updated to 3.26.0 and saw that changes were made that (possibly) makes it easier to pinpoint the problem. With 3.25.3 lookupName

Re: [sqlite] ALTER TABLE, modifying columns

2018-12-12 Thread Thomas Kurz
> I never would have allowed the recent > enhancements to ALTER TABLE that broke it. The enhancements made have been way overdue. Personally, I appreciate them very much and they are worth the "trouble". And I hope that the small problem does not prevent you from taking MODIFY COLUMN and DROP

Re: [sqlite] ALTER TABLE, modifying columns

2018-12-12 Thread Richard Hipp
On 12/12/18, Thomas Kurz wrote: > This doesn't work either. The error now occurs in the "ALTER TABLE" line, > which is correct as the table "x" being refered to doesn't exist that > moment. Tested with both 3.25.2 and 3.26. Can you please post a script showing us exactly what you are trying to

Re: [sqlite] ALTER TABLE, modifying columns

2018-12-12 Thread Richard Hipp
On 12/12/18, Thomas Kurz wrote: > > Btw, has the "correct vs. incorrect" table that you've cited already been > there before release 3.25? The procedure description is unchanged for many years. I added the "Caution:" section recently, because a lot of people have been having the same problem

Re: [sqlite] ALTER TABLE, modifying columns

2018-12-12 Thread Thomas Kurz
een there before release 3.25? - Original Message - From: Shawn Wagner To: SQLite mailing list Sent: Wednesday, December 12, 2018, 18:02:54 Subject: [sqlite] ALTER TABLE, modifying columns You're using a workflow that https://www.sqlite.org/lang_altertable.html explicitly calls out as inc

Re: [sqlite] ALTER TABLE, modifying columns

2018-12-12 Thread Shawn Wagner
You're using a workflow that https://www.sqlite.org/lang_altertable.html explicitly calls out as incorrect and error prone... Try to create a new table, copy data over, drop the original and then rename the new one to see if that fixes the issue. On Wed, Dec 12, 2018, 8:54 AM Thomas Kurz Dear

[sqlite] ALTER TABLE, modifying columns

2018-12-12 Thread Thomas Kurz
Dear all, I don't know whether the behavior is intentional or a bug, so let me describe it (occurs since 3.25): Due to the lack of ALTER TABLE MODIFY COLUMN, I use the following construction: PRAGMA foreign_keys=0 BEGIN TRANSACTION ALTER TABLE x RENAME TO x_old CREATE TABLE IF NOT EXISTS x

Re: [sqlite] alter table, other alter category, fails in presence of trigger on 3.25.2

2018-10-04 Thread Thierry Henrio
Hello Keith, On Thu, Oct 4, 2018 at 1:16 AM Keith Medcalf wrote: > > Unrelated, but are you sure that you want the albums "id int primary key" > and did not happen to misspell "integer" so that the declaration should be > "id integer primary key". In the former case, id is an integer that just

Re: [sqlite] alter table, other alter category, fails in presence of trigger on 3.25.2

2018-10-03 Thread Keith Medcalf
nal Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Thierry Henrio >Sent: Wednesday, 3 October, 2018 16:43 >To: sqlite-users@mailinglists.sqlite.org >Subject: [sqlite] alter table, other alter category, fails in >presence of t

[sqlite] alter table, other alter category, fails in presence of trigger on 3.25.2

2018-10-03 Thread Thierry Henrio
imary key, title text not null, score int); sqlite> INSERT INTO new_albums (id, title, score) SELECT id, title, score FROM albums; sqlite> DROP TABLE albums; sqlite> ALTER TABLE new_albums RENAME TO albums; Error: error in trigger test: no such table: main.albums Expected behavior i

Re: [sqlite] ALTER TABLE

2018-05-23 Thread Donald Griggs
David, that's a useful reminder than trigger and index NAMES are not automatically changed when the referenced table is renamed. Maybe another is that while index and trigger creation statements automatically have the referenced table name changed (at least the non-action trigger commands) by

Re: [sqlite] ALTER TABLE

2018-05-22 Thread David Raymond
trg before delete on foo begin select raise(abort, 'Not a llowing deletes from foo'); end table bar bar 4 CREATE TABLE bar(id integer primary key, foo_id int references foo) sqlite> alter table foo rename to foobar; sqlite> select * from sqlite_master; type

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Charles Leifer
SQLite supports renaming tables, so in my experience you move the old table out of the way, and create the new table with the desired schema and the original name. On Tue, May 22, 2018 at 2:34 PM, Igor Korot wrote: > Hi, Charles, > > On Tue, May 22, 2018 at 2:30 PM, Charles

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Thomas Kurz
statement for that operation. - Original Message - From: David Raymond <david.raym...@tomtom.com> To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org> Sent: Tuesday, May 22, 2018, 22:32:39 Subject: [sqlite] ALTER TABLE Some of these things can get taken care of by si

Re: [sqlite] ALTER TABLE

2018-05-22 Thread David Raymond
QLite mailing list Subject: Re: [sqlite] ALTER TABLE Thinking off the cuff, there'd be a seven step process for this; Begin Transaction Turn off the PK/FK relationship PRAGMA constraint checks Rename old table to a temp table via whatever means are available Create the new table INSERT INTO t

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Paul Sanderson
To modify column names if you want to live dangerously you could try something like this PS C:\sqlite> sqlite3 writ.db SQLite version 3.23.1 2018-04-10 17:39:29 Enter ".help" for usage hints. sqlite> create table test (c1, c2, c3); sqlite> insert into test values(1, 2, 3); sqlite> pragma

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Stephen Chrzanowski
Thinking off the cuff, there'd be a seven step process for this; Begin Transaction Turn off the PK/FK relationship PRAGMA constraint checks Rename old table to a temp table via whatever means are available Create the new table INSERT INTO the new table Turn on the PK/FK relationship PRAGMA

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Simon Slavin
Just to explain to everyone why these commands are harder than they appear at first, consider ALTER TABLE DROP COLUMN . The problem is not in "deleting" the column of data . All you have to do for that is to rename the column something that can't be typed, and remove any constraints built

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Igor Korot
Hi, Charles, On Tue, May 22, 2018 at 2:30 PM, Charles Leifer wrote: > As a workaround, you can always rename the existing table, create the new > table with desired attributes, and do a INSERT INTO ... SELECT FROM > old_table. Then you can safely drop the old table. But the

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Charles Leifer
As a workaround, you can always rename the existing table, create the new table with desired attributes, and do a INSERT INTO ... SELECT FROM old_table. Then you can safely drop the old table. On Tue, May 22, 2018 at 1:14 PM, Thomas Kurz wrote: > > ALTER TABLE ADD COLUMN

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Thomas Kurz
> ALTER TABLE ADD COLUMN has existed for a long time. Yes, sorry, I mixed things up. The order of importance is imho: 1. RENAME COLUMN (shouldn't be too hard) 2. DROP COLUMN (should be a bit more comlicated but feasible) 3. MODIFY COLUMN > What kind of MODIFY COLUMN changes do you have in mind?

Re: [sqlite] ALTER TABLE

2018-05-22 Thread Richard Hipp
On 5/22/18, Thomas Kurz wrote: > I'd like to ask whether there is hope for a more complete support of ALTER > TABLE in the near future, i.e. ADD COLUMN, MODIFY COLUMN, RENAME COLUMN and > DROP COLUMN. ALTER TABLE ADD COLUMN has existed for a long time. What kind of

[sqlite] ALTER TABLE

2018-05-22 Thread Thomas Kurz
I'd like to ask whether there is hope for a more complete support of ALTER TABLE in the near future, i.e. ADD COLUMN, MODIFY COLUMN, RENAME COLUMN and DROP COLUMN. I know about the workaround (alter table rename to, insert, drop table), but this is very inconvenient.

Re: [sqlite] alter table and .schema output

2016-05-30 Thread R Smith
On 2016/05/30 12:39 PM, Luca Ferrari wrote: On Mon, May 30, 2016 at 12:24 PM, Clemens Ladisch wrote: This is normal. The ALTER TABLE adds the new column(s) immediately behind the actual column definition. Inserting a comma before the comment and the rest of the new

Re: [sqlite] alter table and .schema output

2016-05-30 Thread Clemens Ladisch
Luca Ferrari wrote: > Is there a "correct" way to annotate SQL schema? Other databases > provides special commands (e.g., PostgreSQL ADD COMMENT), but I don't > see nothing in SQLIte3 syntax except the SQL '--' one. If those annotations are to be queried, put them into a table. Otherwise, if you

Re: [sqlite] alter table and .schema output

2016-05-30 Thread Luca Ferrari
On Mon, May 30, 2016 at 12:24 PM, Clemens Ladisch wrote: > This is normal. The ALTER TABLE adds the new column(s) immediately > behind the actual column definition. Inserting a comma before the > comment and the rest of the new column definition in the next line would > be

Re: [sqlite] alter table and .schema output

2016-05-30 Thread Clemens Ladisch
Luca Ferrari wrote: > CREATE TABLE pratica_protocollo( > ... > note varchar( 2048 ) -- note per l'integrazione > ); > > ALTER TABLE pratica_protocollo ADD COLUMN cage_attribuzione_anno >integer; > ALTER TABLE pratica_protocollo ADD COLUMN cage_attribuzione_numero >integer; > > and the

[sqlite] alter table and .schema output

2016-05-30 Thread Luca Ferrari
Hi all, I've a doubt about the SQL that .schema provides regarding a single table. I've a table that has been created (and reported back by .schema) as follows: CREATE TABLE pratica_protocollo( ... note varchar( 2048 ) -- note per l'integrazione ); The I ran the following: ALTER TABLE

[sqlite] ALTER TABLE ADD COLUMN

2015-05-22 Thread Christoph P.U. Kukulies
Am 21.05.2015 um 13:44 schrieb Simon Slavin: > On 21 May 2015, at 7:51am, Christoph P.U. Kukulies > wrote: > >> Now I wonder why I don't read >> CREATE TABLE [database] ( >> [database_name] TEXT NULL, >> [table_name] TEXT NULL, >> [data_type] TEXT NULL, >> [data_size] INTEGER NULL, >>

[sqlite] ALTER TABLE ADD COLUMN

2015-05-21 Thread Kees Nuyt
On Thu, 21 May 2015 12:45:41 +0200, "Christoph P.U. Kukulies" wrote: >Am 21.05.2015 um 10:00 schrieb Kees Nuyt: >> On Thu, 21 May 2015 09:40:53 +0200, "Christoph P.U. Kukulies" >> wrote: >> >>> Am 21.05.2015 um 09:25 schrieb Hick Gunter: alter table [database] add column [real_length]

[sqlite] ALTER TABLE ADD COLUMN

2015-05-21 Thread Christoph P.U. Kukulies
Am 21.05.2015 um 10:00 schrieb Kees Nuyt: > On Thu, 21 May 2015 09:40:53 +0200, "Christoph P.U. Kukulies" > wrote: > >> Am 21.05.2015 um 09:25 schrieb Hick Gunter: >>> alter table [database] add column [real_length] numeric; >> Thanks, that did it right. Almost. Still I'm wondering why >> the

[sqlite] ALTER TABLE ADD COLUMN

2015-05-21 Thread Simon Slavin
On 21 May 2015, at 7:51am, Christoph P.U. Kukulies wrote: > Now I wonder why I don't read > CREATE TABLE [database] ( > [database_name] TEXT NULL, > [table_name] TEXT NULL, > [data_type] TEXT NULL, > [data_size] INTEGER NULL, > [column_name] TEXT NULL, > [vendor] TEXT DEFAULT 'SQLBASE'

[sqlite] ALTER TABLE ADD COLUMN

2015-05-21 Thread Christoph P.U. Kukulies
Am 21.05.2015 um 09:08 schrieb Jean-Christophe Deschamps: > At 08:51 21/05/2015, you wrote: > >> I used sqlite3.exe by invoking it on the command line with the name >> of a database. >> Next I typed >> >> alter table database add column real_length numeric; >> >> Next I typed .fullschema >> and

[sqlite] ALTER TABLE ADD COLUMN

2015-05-21 Thread Christoph P.U. Kukulies
case 'numeric') sqlite> .fullschema CREATE TABLE [database] ( [database_name] TEXT NULL, [table_name] TEXT NULL, [data_type] TEXT NULL, [data_size] INTEGER NULL, [column_name] TEXT NULL, [vendor] TEXT DEFAULT 'SQLBASE' NULL ); /* No STAT tables available */ sqlite> alter table [database] add

[sqlite] ALTER TABLE ADD COLUMN

2015-05-21 Thread Jean-Christophe Deschamps
At 08:51 21/05/2015, you wrote: >I used sqlite3.exe by invoking it on the command line with the name of >a database. >Next I typed > > alter table database add column real_length numeric; > >Next I typed .fullschema >and I'm getting: > >sqlite> .fullschema >CREATE TABLE [database] (

[sqlite] ALTER TABLE ADD COLUMN

2015-05-21 Thread Christoph P.U. Kukulies
I used sqlite3.exe by invoking it on the command line with the name of a database. Next I typed alter table database add column real_length numeric; Next I typed .fullschema and I'm getting: sqlite> .fullschema CREATE TABLE [database] ( [database_name] TEXT NULL, [table_name] TEXT NULL,

[sqlite] ALTER TABLE ADD COLUMN

2015-05-21 Thread Hick Gunter
Try alter table [database] add column [real_length] numeric; -Urspr?ngliche Nachricht- Von: Christoph P.U. Kukulies [mailto:kuku at kukulies.org] Gesendet: Donnerstag, 21. Mai 2015 08:51 An: General Discussion of SQLite Database Betreff: [sqlite] ALTER TABLE ADD COLUMN I used sqlite3

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

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

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

2014-12-16 Thread Nico Williams
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... there's no IF NOT EXISTS .. equivalent for ALTER TABLE. Funny

Re: [sqlite] ALTER TABLE ... RENAME and indices.

2013-08-12 Thread Richard Hipp
On Mon, Aug 12, 2013 at 4:34 PM, Scott Hess wrote: > I had been attempting to write some code like this: > > CREATE TABLE t (x); > CREATE INDEX t_x ON t(x); > -- bunch of operations over a long period. > -- now we want to run an expiration pass: > BEGIN; > ALTER TABLE t RENAME

Re: [sqlite] Alter table constraint question

2012-09-09 Thread Peter Aronson
As pointed out, there are products out there that will add or drop constraints (by doing all the tedious table creation/rename/drop under the covers) for SQLite. The other approach is to do what SpatiaLite does in general -- use triggers instead of check constraints but for the same purpose

Re: [sqlite] Alter table constraint question

2012-09-09 Thread Peter Haworth
t 9:00 AM, <sqlite-users-requ...@sqlite.org> wrote: > Message: 9 > Date: Sun, 9 Sep 2012 11:19:21 +0200 > From: Andrea Peri <aperi2...@gmail.com> > To: sqlite-users@sqlite.org > Subject: [sqlite] Alter table constraint question > Message-ID: >

[sqlite] Alter table constraint question

2012-09-09 Thread Andrea Peri
Hi, I'm an user of sqlite with the spatial extension "spatialite". I see the sqlite db allow to define a constraints when are in the creating phase of the table. But is not possible to add or drop a constraint after the table is created. In the GIS data the availability of the constraints is a

Re: [sqlite] Alter table: number size

2012-02-28 Thread Richard Hipp
On Tue, Feb 28, 2012 at 7:14 AM, Marco Turco wrote: > Hi all, > > I need to alter a field from smallint(1) to smallint(2), > No you don't; not unless your application or the wrapper you are using are reading the schema or datatypes separately. SQLite itself makes no

[sqlite] Alter table: number size

2012-02-28 Thread Marco Turco
Hi all, I need to alter a field from smallint(1) to smallint(2), is there to do this using ALTER TABLE ? Thanks in advance Marco ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 06/02/12 12:50, Tim Streater wrote: > Can that [pragma user_version] be relied upon, though? It is used by both Firefox and Android. The actual value is stored in the SQLite header. It would be astonishing and unprecedented for the SQLite team

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Nico Williams
I'm pretty sure that the user_version pragma is considered stable. That said, if your application is in full control of the DB then you could just check the exact create statements logged in sqlite_master (this is probably less stable, ironically enough).

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Tim Streater
On 06 Feb 2012 at 19:31, Ryan Johnson wrote: > On 06/02/2012 1:59 PM, Bill McCormick wrote: >> The order is not important. What is important is that I come up with >> some way to manage version updates. I've tried doing something similar >> in the past using an

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Ryan Johnson
On 06/02/2012 1:59 PM, Bill McCormick wrote: Nico Williams wrote, On 2/6/2012 12:44 PM: On Mon, Feb 6, 2012 at 9:36 AM, Bill McCormick wrote: Is there no way to force columns added to a table with alter table to be added at certain column positions? Alternatively, if

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Bill McCormick
Nico Williams wrote, On 2/6/2012 12:44 PM: On Mon, Feb 6, 2012 at 9:36 AM, Bill McCormick wrote: Is there no way to force columns added to a table with alter table to be added at certain column positions? Alternatively, if there is some way to save the data in an

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Nico Williams
On Mon, Feb 6, 2012 at 9:36 AM, Bill McCormick wrote: > Is there no way to force columns added to a table with alter table to be > added at certain column positions? > > Alternatively, if there is some way to save the data in an existing table; > drop the table; re-create

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Black, Michael (IS)
AM To: General Discussion of SQLite Database Subject: EXT :Re: [sqlite] ALTER TABLE On 2/6/2012 9:22 AM, Bill McCormick wrote: > Sorry, I should have mentioned that I did see that, but it doesn't > quite fit my application. I need a script that doesn't care what the > existing table l

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Gerry Snyder
On 2/6/2012 9:22 AM, Bill McCormick wrote: Sorry, I should have mentioned that I did see that, but it doesn't quite fit my application. I need a script that doesn't care what the existing table looks like. In my situation, I may have dozens of databases among different locations, perhaps not

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Bill McCormick
Gerry Snyder wrote, On 2/6/2012 9:48 AM: On 2/6/2012 8:36 AM, Bill McCormick wrote: Is there no way to force columns added to a table with alter table to be added at certain column positions? Alternatively, if there is some way to save the data in an existing table; drop the table; re-create

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Gerry Snyder
On 2/6/2012 8:36 AM, Bill McCormick wrote: Is there no way to force columns added to a table with alter table to be added at certain column positions? Alternatively, if there is some way to save the data in an existing table; drop the table; re-create the table with the desired schema; and

Re: [sqlite] ALTER TABLE

2012-02-06 Thread Puneet Kishor
On Feb 6, 2012, at 9:36 AM, Bill McCormick wrote: > Is there no way to force columns added to a table with alter table to be > added at certain column positions? > > Alternatively, if there is some way to save the data in an existing table; > drop the table; re-create the table with the

[sqlite] ALTER TABLE

2012-02-06 Thread Bill McCormick
Is there no way to force columns added to a table with alter table to be added at certain column positions? Alternatively, if there is some way to save the data in an existing table; drop the table; re-create the table with the desired schema; and then reload the data, this would be useful as

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.

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

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

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:

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.

[sqlite] alter table add column

2011-05-31 Thread Fabio Spadaro
"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? -- Fabio Spadaro www.fabiospadaro.com ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] ALTER TABLE and INTEGER PRIMARY KEY.

2007-08-15 Thread Scott Hess
ROTECTED] > Sent: Tuesday, August 14, 2007 8:22 PM > To: [EMAIL PROTECTED] > Cc: sqlite-users@sqlite.org > Subject: Re: [sqlite] ALTER TABLE and INTEGER PRIMARY KEY. > > On 8/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > "Scott Hess" <[EMAIL PR

RE: [sqlite] ALTER TABLE and INTEGER PRIMARY KEY.

2007-08-14 Thread Samuel R. Neff
:[EMAIL PROTECTED] Sent: Tuesday, August 14, 2007 8:22 PM To: [EMAIL PROTECTED] Cc: sqlite-users@sqlite.org Subject: Re: [sqlite] ALTER TABLE and INTEGER PRIMARY KEY. On 8/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > "Scott Hess" <[EMAIL PROTECTED]> wrote: > >

Re: [sqlite] ALTER TABLE and INTEGER PRIMARY KEY.

2007-08-14 Thread drh
"Scott Hess" <[EMAIL PROTECTED]> wrote: > > > > It appears that you can set > > > >PRAGMA writable_schema=ON; > > > > Then do a manual UPDATE of the sqlite_master table to insert > > an "id INTEGER PRIMARY KEY" into the SQL for the table definition. > > I tried it and it seems to work. But it

Re: [sqlite] ALTER TABLE and INTEGER PRIMARY KEY.

2007-08-14 Thread Scott Hess
On 8/14/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > "Scott Hess" <[EMAIL PROTECTED]> wrote: > > I was getting ready to checkin the rowid-versus-fts2 fix, and wanted > > to add one last bit, to upgrade older tables. > > > > Unfortunately, code of the form: > > > >ALTER TABLE x_segments

Re: [sqlite] ALTER TABLE and INTEGER PRIMARY KEY.

2007-08-14 Thread Joe Wilson
--- [EMAIL PROTECTED] wrote: > "Scott Hess" <[EMAIL PROTECTED]> wrote: > > I was getting ready to checkin the rowid-versus-fts2 fix, and wanted > > to add one last bit, to upgrade older tables. > > > > Unfortunately, code of the form: > > > >ALTER TABLE x_segments ADD id INTEGER PRIMARY KEY;

Re: [sqlite] ALTER TABLE and INTEGER PRIMARY KEY.

2007-08-14 Thread Joe Wilson
--- Scott Hess <[EMAIL PROTECTED]> wrote: > This may mean that I'll need to branch fts2 to fts3 and deprecate > fts1/2 as being not safe for use. If the code is going to have to > create new tables and populate them, then there's not a lot of gain > versus just having the developer do that. Is

Re: [sqlite] ALTER TABLE and INTEGER PRIMARY KEY.

2007-08-14 Thread drh
"Scott Hess" <[EMAIL PROTECTED]> wrote: > I was getting ready to checkin the rowid-versus-fts2 fix, and wanted > to add one last bit, to upgrade older tables. > > Unfortunately, code of the form: > >ALTER TABLE x_segments ADD id INTEGER PRIMARY KEY; > > is documented as not supported. >

[sqlite] ALTER TABLE and INTEGER PRIMARY KEY.

2007-08-14 Thread Scott Hess
I was getting ready to checkin the rowid-versus-fts2 fix, and wanted to add one last bit, to upgrade older tables. Unfortunately, code of the form: ALTER TABLE x_segments ADD id INTEGER PRIMARY KEY; is documented as not supported. http://www.sqlite.org/lang_altertable.html . As far as I can

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]

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

2007-06-03 Thread Mark Gilbert
Folks. I had been struggling to implement ALTER TABLE ADD COLUMN in my app to change the database structure. However I would continuously face a locked database error. After much experimentation I have come to a very very strange conclusion. In my app if I do this: -start app -open

[sqlite] ALTER TABLE

2007-04-26 Thread BardzoTajneKonto
Is there a reason why ALTER TABLE ADD can add only one column? I'v changed the parser to allow any number of columns - I'm calling sqlite3AlterFinishAddColumn() for every column. It seems to work. Am I missing some problem, or nobody wanted more columns before? Wiktor Adamski

Re: [sqlite] ALTER table command

2006-06-19 Thread Clark Christensen
Assuming a schema like: create table t1 (a,b); Add another column, "c" alter table t1 add column c; -Clark - Original Message From: Anish Enos Mathew <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Monday, June 19, 2006 12:42:46 AM Subject: [sqlite] ALTER ta

Re: [sqlite] ALTER table command

2006-06-19 Thread John Newby
http://www.sqlite.org/faq.html#q13 Hi, SQLite FAQ recommends creating temp tables and copying the data from the original table into it then deleting the old table then recreating the old table (with the desired new column) then copying the data back and deleting the temp table. On 19/06/06,

[sqlite] ALTER table command

2006-06-19 Thread Anish Enos Mathew
Hi all, Any body knows how to use ADD [COLUMN] in alter table command? I want to add a new field to my table. Can "modify " be used with alter command as in SQL? The information contained in, or attached to, this e-mail, contains confidential information and is intended solely for the use of

Re: [sqlite] Alter table to add a variable named column

2006-05-23 Thread Pam Greene
The workaround would be to build the statement some other way (sqlite3_mprintf(), for example) for each individual ALTER TABLE command. At that point you may want to use sqlite3_exec() instead of sqlite3_prepare(), depending on how you'll be using the statement. You'll also have to be more

Re: [sqlite] Alter table to add a variable named column

2006-05-23 Thread Dennis Cote
Kevin Piciulo wrote: Can I add a column using a variable for the column name? Below is the prepare statement, which is returning an error. sqlite3_prepare(m_dbDataBase, "ALTER TABLE users ADD COLUMN ? varchar;", -1, , NULL); I'm pretty sure my syntax is correct which leads me to believe

[sqlite] Alter table to add a variable named column

2006-05-23 Thread Kevin Piciulo
I asked a similar question to this about accessing columns using a variable name, and the answer was you cannot. Sadly I cannot find the email explaining why so I'll ask this similar question: Can I add a column using a variable for the column name? Below is the prepare statement, which

Re: [sqlite] alter table syntax ?

2006-02-23 Thread Kurt Welgehausen
$ sqlite test2.db > SQLite version 2.8.16 > Enter ".help" for instructions > sqlite> create table x1 ( name ); > sqlite> alter table x1 add column ( phone ); > SQL error: near "alter": syntax error > sqlite> There's no statement in Sqlite v2.x; switch to v3 if you need it. Regards

[sqlite] alter table syntax ?

2006-02-23 Thread Doug Fajardo
eate table x1 ( name ); sqlite> alter table x1 add column ( phone ); SQL error: near "alter": syntax error sqlite>

[sqlite] ALTER TABLE Command restrictions

2005-11-22 Thread Robert Foster
Hi, I was just playing with ALTER TABLE, and it appears that you can only add 1 column with each command. Is this correct? If so, how hard would it be to enable adding multiple columns with the same command? Thanks, Robert Foster General Manager Mountain Visions P/L

Re: [sqlite] ALTER TABLE: Confusing documentation

2005-07-27 Thread Tito Ciuro
On 27/07/2005, at 13:04, Kurt Welgehausen wrote: The docs are correct; you just have to read carefully. I have :-) They say that you can "rename, or add a new column to, an existing table". No, it doesn't. It states that you can "rename or add a new column to an existing table."

Re: [sqlite] ALTER TABLE: Confusing documentation

2005-07-27 Thread Kurt Welgehausen
The docs are correct; you just have to read carefully. They say that you can "rename, or add a new column to, an existing table". Regards

Re: [sqlite] alter table rename column

2005-05-07 Thread Will Leshner
On May 7, 2005, at 3:14 PM, Kurt Welgehausen wrote: SQLite's version of the ALTER TABLE command allows the user to rename, or add a new column to, an existing table. Aha. Ok. I get it now :)

  1   2   >