Re: [sqlite] Unexpected or wrong result and no warning/error, bug?

2019-04-12 Thread Tony Papadimitriou
True, but SQLite3 is known to provide several conveniences that are not necessarily standard SQL. -Original Message- From: Simon Slavin Sent: Friday, April 12, 2019 7:11 PM On 12 Apr 2019, at 5:00pm, Tony Papadimitriou wrote: update t set s = replace(s, 'USA', '___'),

Re: [sqlite] Unexpected or wrong result and no warning/error, bug?

2019-04-12 Thread Simon Slavin
On 12 Apr 2019, at 5:00pm, Tony Papadimitriou wrote: > update t set s = replace(s, 'USA', '___'), > s = replace(s,'US','USA'), > s = replace(s,'___','USA'); To add to the answers other people gave, there's no set order for SQL to process these changes. The SQL

Re: [sqlite] Unexpected or wrong result and no warning/error, bug?

2019-04-12 Thread Tony Papadimitriou
I know this, thanks. I simply made a test case that can be run in MySQL, Postgreq and SQLite3. -Original Message- From: Chris Locke create table t(s varchar(5)); Also note that SQLite doesn't 'understand' varchar (it uses text) and it doesn't limit the entry to 5 characters. This

Re: [sqlite] Unexpected or wrong result and no warning/error, bug?

2019-04-12 Thread Chris Locke
> create table t(s varchar(5)); Also note that SQLite doesn't 'understand' varchar (it uses text) and it doesn't limit the entry to 5 characters. This doesn't help your issue directly, but does highlight that you've not read the SQLite documentation, and aren't creating tables properly. On Fri,

Re: [sqlite] Unexpected or wrong result and no warning/error, bug?

2019-04-12 Thread Shawn Wagner
From the documentation (https://www.sqlite.org/lang_update.html) If a single column-name appears more than once in the list of assignment expressions, all but the rightmost occurrence is ignored. On Fri, Apr 12, 2019, 9:00 AM Tony Papadimitriou wrote: > create table t(s varchar(5)); > >

[sqlite] Unexpected or wrong result and no warning/error, bug?

2019-04-12 Thread Tony Papadimitriou
create table t(s varchar(5)); insert into t values('US'),('USA'); update t set s = replace(s, 'USA', '___'), s = replace(s,'US','USA'), s = replace(s,'___','USA'); select * from t; -- Expected answer: -- USA -- USA -- --