Null check operator used on a null value
The relevant error-causing widget was
MaterialApp
lib\main.dart:16
Related
To read an integer column into integer list
create function somedum()
returning int
define s LIST(INTEGER NOT NULL);
select id into s from informix.emptest;
end function
create table emptest(id int)
insert into emptest(id)values(7)
when I execute the above function
iam getting error as attached image
The Informix documentation on inserting elements into a LIST seems misleading to me, as my first impression of the example ( Insert into a LIST ) also led me to use the SELECT INTO syntax and get the same error:
-9634 No cast from integer to set(integer not null)
The SELECT INTO syntax can be used to copy/insert an entire LIST, not elements into the LIST.
To insert an element into the LIST ( or generally manipulate it's elements ) we need to use the Informix virtual table interface, in this case using the TABLE syntax to create a virtual table from the LIST which then can be used to do the usual insert/select/update/delete operations ( Collection-Derived Table ).
CREATE FUNCTION somedum()
RETURNING LIST( INTEGER NOT NULL ) AS alist;
DEFINE my_list LIST( INTEGER NOT NULL );
INSERT INTO TABLE( my_list ) SELECT id FROM emptest;
RETURN my_list;
END FUNCTION;
Executing the function we get:
EXECUTE FUNCTION somedum();
alist LIST{7 }
I have a cypher query as follows:
MATCH (u:User {uid:"984172414"})-[ru:EB]->
(c:Co)<-[rf:EB]-(f:User)-[rc :EB]->(cc:Co)
WHERE (cc.uid in ["84161623"]) AND (rc.from IS NOT NULL AND rc.to IS NULL) AND
((
ru.from IS NOT NULL AND
ru.to IS NOT NULL AND
(
(rf.from <= ru.to) OR
(ru.from <= rf.to)
)
) OR (
ru.from IS NOT NULL AND
ru.to IS NULL AND
(
(ru.from <= rf.to) OR
(rf.from IS NOT NULL AND rf.to IS NULL)
)
) OR (
ru.from IS NULL AND
ru.to IS NOT NULL AND
(
(rf.from <= ru.to) OR
(rf.from IS NULL AND rf.to IS NOT NULL)
)
))
RETURN cc.name as coname,
f.name as fname,
cc.uid as cuid,
f.uid as fuid,
labels(f) as flabels,
null as version
LIMIT 20
This takes about 16192 ms to resolve. I have an index on co.uid but seems like it's not working. If I remove the check cc.uid in ["84161623"] and run the following query:
MATCH (u:User {uid:"984172414"})-[ru:EB]->
(c:Co)<-[rf:EB]-(f:User)-[rc :EB]->(cc:Co)
WHERE (rc.from IS NOT NULL AND rc.to IS NULL) AND
((
ru.from IS NOT NULL AND
ru.to IS NOT NULL AND
(
(rf.from <= ru.to) OR
(ru.from <= rf.to)
)
) OR (
ru.from IS NOT NULL AND
ru.to IS NULL AND
(
(ru.from <= rf.to) OR
(rf.from IS NOT NULL AND rf.to IS NULL)
)
) OR (
ru.from IS NULL AND
ru.to IS NOT NULL AND
(
(rf.from <= ru.to) OR
(rf.from IS NULL AND rf.to IS NOT NULL)
)
))
RETURN cc.name as coname,
f.name as fname,
cc.uid as cuid,
f.uid as fuid,
labels(f) as flabels,
null as version
LIMIT 20
The query resolves in only 347 ms. I can't figure out what is wrong with the (cc.uid in ["84161623"]) statement and why does adding this to the query takes 16 seconds to resolve when I already have an index on the uid. Any help will be appreciated.
update
As suggested by #cybersam I tried making the use of USING INDEX but that results in the following error:
Cannot use index hint in this context. Index hints require using an equality comparison or IN condition in WHERE (either directly or as part of a top-level AND). The comparison cannot be between two property values. Note that the label and property comparison must be specified on a non-optional node
Try using a USING INDEX clause to provide a hint to use that index. The Cypher processing code does not always automatically generate the most efficient code.
For example, put this between the MATCH and WHERE clauses:
USING INDEX cc:Co(uuid)
You may also need to use additional USING INDEX clauses if there are other indices. Note, however, that neo4j can not use indices in all situations; and, even if it is possible, the resulting query could theoretically be slower due to other resulting changes to the query. So, take a look at the resulting profile and test the result to make sure you are happy with it.
Sounds like you may need to do some sanity checking.
First of all, is :Co.uid an int or a string? It looks like you're addressing it as if it's a string, yet the values themselves look numeric. If it's an int, you can get rid of the quotes.
Same with :User.uid.
If you've been comparing ints to strings all this time, try fixing that first to see if it solves the problem. If not, you'll want to start profiling and figuring out if/when the query isn't using your index.
Next, try simplifying and profiling the query to see if the indices are actually being used:
PROFILE MATCH (u:User {uid:"984172414"}), (cc:Co)
WHERE (cc.uid in ["84161623"])
RETURN u, cc
If they're both using NodeIndexSeek or NodeUniqueIndexSeek, and if the db hits seem reasonable, you might expand out to your entire path and continue profiling. However, it's worth checking for a performance improvement if you match on the start and end nodes first, like above, then try to do your additional pattern matching. For example:
PROFILE MATCH (u:User {uid:"984172414"}), (cc:Co)
WHERE (cc.uid in ["84161623"])
WITH u, cc
MATCH (u)-[ru:EB]->(c:Co)<-[rf:EB]-(f:User)-[rc :EB]->(cc)
WHERE (rc.from IS NOT NULL AND...
I am using contao 4 but I had this problem already in version 3.
I have created a table with some columns. One of this column is marked as int(10) default NULL. Nothing special about that.
However: When I run my database upate, this column is always shown as changed.
ALTER TABLE `tl_products` CHANGE `tags` `tags` int(10) default NULL;
It doenst matter how often I press upate. This statement never disappears.
I already saw that at different other cases (e.g. when one writes default 0 instead of default '0'). Does anyone know how to fix this one?
The correct definition is
int(10) NULL
which should work in Contao. Your previous definition, int(10) default NULL is shorthand for int(10) NOT NULL default NULL, which makes no sense of course (thus it cannot be detected by Contao).
I'm writing triggers to detect changes in fields in a database, and it appears I have to do really obnoxious things like
(SELECT SalesPrice FROM __old) <> (SELECT SalesPrice FROM __new)
or ((SELECT SalesPrice FROM __old) IS NULL and (SELECT SalesPrice FROM __new) IS NOT NULL)
or ((SELECT SalesPrice FROM __old) IS NOT NULL and (SELECT SalesPrice FROM __new) IS NULL)
rather than just
(SELECT SalesPrice FROM __old) <> (SELECT SalesPrice FROM __new)
to accurately detect if a field changed.
Am I missing something, or does Advantage effectively claim that NULL == any value? Is there a good reason for this behavior? Is this some weird thing in the SQL definition? Is there a more succinct way this that doesn't do 3 checks in place of one?
This is unfortunately how SQL works with NULL values. NULL is not equal to anything, it is UNKNOWN. For example,
somevalue == NULL -> unknown
somevalue <> NULL -> unknown
As a result it will never pass a "true" check
Null Values - Wikipedia
There are a couple of options:
A) Do not allow null values (I recommend combining this with a default value)
B) Use IFNULL to set the field to some value such as
(SELECT IFNULL(SalesPrice, -9999) FROM __OLD) <> (SELECT IFNULL(SalesPrice, -9999) FROM __NEW)
But I don't know if I necessarily like this since a value must be picked that would not be valid.
In SQL, NULL does not compare to anything, except the IS [NOT] NULL expression. If I understand you question correctly, the problem here is that NULL must equal to NULL. If that is the case, the check may be simplified to:
( SELECT CASE WHEN n.SalesPrice IS NULL and o.SalePrice IS NULL THEN TRUE
ELSE n.SalesPrice = o.SalesPrice END
FROM __old o, __new n )
In Informix:
how to check for not null,
I have a field with datetime data type, and I don't have any default values for this field, but I have lot of empty/null records for this field.
I want a query that will render the records:
( cond like ) where my_curr_date_time != ""
but if I try this query, it is not working. Please tell which query for finding not null records.
... WHERE my_curr_date_time IS NOT NULL
NULL is a special value. It may mean "no value" or "value unknown". In SQL if you want to check if value is or not is NULL then you must use ... yes ... value IS NULL or value IS NOT NULL. It may be used with other conditions like:
... WHERE my_curr_date_time IS NOT NULL AND my_curr_date_time > start_dt