Questions tagged [notnull]

This tag refers to an object or type that is not null (none).

Use this tag for questions related to not-null types or objects (i.e. detecting them, handling them, etc.).

295 questions
2
votes
2 answers

@NotNull Deprecated in Antlr 4.6+ What to use instead?

I'm building a parser using Antlr 4.8, and the @NotNull annotation is marked as deprecated: org.antlr.v4.runtime.misc Annotation Type NotNull Deprecated. THIS IS HERE FOR BACKWARD COMPATIBILITY WITH 4.5 ONLY. It will disappear in 4.6+ I have…
Ramesh
  • 613
  • 1
  • 10
  • 28
2
votes
0 answers

c# Minimum required of optional parameters

So I'm trying to get a list of relation existing between two table to validate some integration test. The database is pretty simple : Table1 <- RelationTable -> Table2 I would like to get the existing relation from a list of Table1 Ids or a list of…
2
votes
1 answer

Use the ref principle on the new not null test

I do not know what it is called exactly, but for now I will refer to it as 'not null test'. In C# 8 there is a new behavior which allows to test if an object is not null e.g.: Foo foo = new Foo(); if(foo is { }) { //foo is not null } You can…
Twenty
  • 5,234
  • 4
  • 32
  • 67
2
votes
1 answer

Formatting php echo with null values

Let's say I have a php array called $t with 5 elements in it. For demonstration purposes, let's call it $t = [a,b,c,d,e]. I want to echo all elements in parenthesis like this: (a, b, c, d, e). However, I want this parenthesis format to hold if there…
Programmer
  • 1,266
  • 5
  • 23
  • 44
2
votes
2 answers

Is there any difference between inline and out-of-line constraint in sql?

Which one to use or which one is the better? There's any difference? searchtype_id bigint NOT NULL or CONSTRAINT searchtype_id_nn CHECK ((searchtype_id IS NOT NULL))
2
votes
1 answer

Why default is not used when I set not null contratint?

I have table in postgresql database. For given column I set default value, then I want it to be NOT NULL: ALTER TABLE "order" ALTER COLUMN last_bill_date SET DEFAULT '-Infinity'; ALTER TABLE "order" ALTER COLUMN last_bill_date SET NOT NULL; But…
Eugen Konkov
  • 22,193
  • 17
  • 108
  • 158
2
votes
1 answer

Make Java infer @NotNull for Optional Return Types

Using Optionals in Java does not protect from NPEs since values still can be null: Optional myMethod() { return null; } A way to protect from this at least at runtime is the use of @NotNull annotations. (Not possible at compile time in…
fabb
  • 11,660
  • 13
  • 67
  • 111
2
votes
1 answer

PostgreSQL - empty values that are not null and not empty strings

I ran this query on a PostgreSQL table: select * wkt from table where column <>'' and column is not null ..and unexpectedly received several rows with no visible value in that column. Why is this? Is there some 'hidden' value in that column for…
JasonBK
  • 539
  • 3
  • 12
  • 37
2
votes
1 answer

Can't avoid Intellij throwing IllegalArgumentException with @NotNull

Is there anything else I can do when unchecking "Add runtime assertions for not-null annotated methods and parameters" doesn't work? It keeps throwing IllegalArgumentException. I've also tried disabling the Inspections for @NotNull/@Nullable…
garci560
  • 2,993
  • 4
  • 25
  • 34
2
votes
2 answers

How to Insert default into not null column if value is null in Maria db

I have below table structure: CREATE TABLE Table_1( id int AutoIncrement PRIMARY KEY, message varchar(64) NOT NULL DEFAULT 'NA' ) I run the below query: INSERT INTO Table_1 (id, message) VALUES (null, null); It gives me Error: Error Code:…
SAM
  • 21
  • 1
  • 4
2
votes
2 answers

Should Foreign Key Columns be Unique and Not Null?

I understand that, unless specified, foreign key columns can be NULL and duplicated (at least in Oracle SQL). Is it better practice to have foreign key columns declared not null and unique or leave them as is? Is this a decision that should be made…
Zampanò
  • 574
  • 3
  • 11
  • 33
2
votes
1 answer

Set some field 'NOT NULL' only if a field has a special value

CREATE TABLE Persona( CF VARCHAR(16) PRIMARY KEY, Nome VARCHAR(50) NOT NULL, Cognome VARCHAR(50) NOT NULL, Email VARCHAR(50) NOT NULL, RuoloPersona VARCHAR(20) NOT NULL CHECK(RuoloPersona IN ('Studente', 'Professore', 'Tutor',…
Stefano Berti
  • 141
  • 1
  • 11
2
votes
2 answers

Get total number of not null records in Android SQLite database

I want to get the number of NOT NULL records from my SQLite database. Since I'm using autoincrement, the last inserted row won't give me the real number of records in the table as even if I delete any middle record, it'll insert at the position…
neha
  • 6,327
  • 12
  • 46
  • 78
2
votes
2 answers

Elastic Search query to check for null values in 2 fields

What is the elastic search query to search for documents where "field1 is null OR field2 is null".. I am using elasticSearch 5.3...
Selva
  • 21
  • 1
  • 1
  • 4
2
votes
1 answer

Fluent NHibernate - automapping: allow null for single properties

I know this question has been raised in similar form multiple times, but none of the threads could give me the concrete answer to my question. I use Fluent NHibernate and Fluent`s auto-mapping to map my domain entities. Right now, I use this…
abedurftig
  • 1,118
  • 1
  • 12
  • 24