Does PRIMARY KEY imply NOT NULL?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Does PRIMARY KEY imply NOT NULL?

Baruch Burstein-2
Question in the subject

--
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Does PRIMARY KEY imply NOT NULL?

John McKown
On Wed, Sep 9, 2015 at 3:56 PM, Baruch Burstein <[hidden email]>
wrote:

> Question in the subject
>
> --
>
>
​Answered on the SQLite web site: http://sqlite.org/lang_createtable.html

<quote>
According to the SQL standard, PRIMARY KEY should always imply NOT NULL.
Unfortunately, due to a bug in some early versions, this is not the case in
SQLite. Unless the column is an INTEGER PRIMARY KEY
<http://sqlite.org/lang_createtable.html#rowid> or the table is a WITHOUT
ROWID <http://sqlite.org/withoutrowid.html> table or the column is declared
NOT NULL, SQLite allows NULL values in a PRIMARY KEY column. SQLite could
be fixed to conform to the standard, but doing so might break legacy
applications. Hence, it has been decided to merely document the fact that
SQLite allowing NULLs in most PRIMARY KEY columns.
</quote>​



--

Schrodinger's backup: The condition of any backup is unknown until a
restore is attempted.

Yoda of Borg, we are. Futile, resistance is, yes. Assimilated, you will be.

He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Does PRIMARY KEY imply NOT NULL?

Baruch Burstein-2
On Thu, Sep 10, 2015 at 12:04 AM, John McKown <[hidden email]>
wrote:

> On Wed, Sep 9, 2015 at 3:56 PM, Baruch Burstein <[hidden email]>
> wrote:
>
> > Question in the subject
> >
> > --
> >
> >
> ​Answered on the SQLite web site: http://sqlite.org/lang_createtable.html


Thank you. I knew I had seen something about this once, but didn't find it.


--
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Native sqlite4 on FreeBSD

Valentin Davydov-2
Hi, all!

How to build native sqlite4 (preferrably statically linked shell only,
without any extensions) on a recent version of FreeBSD? It has clang
instead of gcc as a default system compiler, so makefiles bundled with
sqlite sources don't work.

Valentin Davydov.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Native sqlite4 on FreeBSD

mhoenicka
At 2015-09-10 13:22, Valentin Davydov was heard to say:
> Hi, all!
>
> How to build native sqlite4 (preferrably statically linked shell only,
> without any extensions) on a recent version of FreeBSD? It has clang
> instead of gcc as a default system compiler, so makefiles bundled with
> sqlite sources don't work.
>
> Valentin Davydov.

Hi,
the default system compiler is meant to build and update your system and
your ports. You can use it for compiling everything else, but you don't
have to. Several gcc versions are provided as ports/packages, so just
install what you prefer to build non-port based software.

regards,
Markus

--
Markus Hoenicka
http://www.mhoenicka.de
AQ score 38

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Native sqlite4 on FreeBSD

Eduardo Morras-2
In reply to this post by Valentin Davydov-2
On Thu, 10 Sep 2015 14:22:24 +0300
Valentin Davydov <[hidden email]> wrote:

> Hi, all!
>
> How to build native sqlite4 (preferrably statically linked shell only,
> without any extensions) on a recent version of FreeBSD? It has clang
> instead of gcc as a default system compiler, so makefiles bundled with
> sqlite sources don't work.

Use gmake to compile. Note that there isn't a port, sqlite4 is in development state and not a final product.

> Valentin Davydov.

---   ---
Eduardo Morras <[hidden email]>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Native sqlite4 on FreeBSD

Valentin Davydov-2
On Thu, Sep 10, 2015 at 01:30:37PM +0200, Eduardo Morras wrote:
>
> Use gmake to compile.

It didn't work either. Finally I've just installed some brand new linux
on a nearby virtual machine, made there make -f Makefile.linux-gcc and
thoroughly repeated it's output line-by-line on my FreeBSD while replacing
gcc by cc. Eventually it compiled well (with almost the same set of warnings)
and the result seems to work (at least within my own coverage).

Thanks to the high general coding style, there were only two idiosyncrasies
to be corrected: lack of the system-wide malloc.h (which is replaced by
unistd.h in FreeBSD) and yet another lack of the fdatasync() syscall, which
is already carefully screened from the sources by a special symbol called
__ANDROID__ ;-)

By the way, clang kindly revealed a couple of forgotten "unsigned" in the
sources, which could (and did in the past) produce some nice bugs. Attention
to developers.

> Note that there isn't a port,

I know. Despite the code being frozen for almost a full year, nobody
wants to take a trouble of maintaining FreeBSD port (perhaps me too).

Valentin Davydov.

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Native sqlite4 on FreeBSD

Will Parsons
On Friday, 11 Sep 2015 10:12 AM -0400, Valentin Davydov wrote:

> On Thu, Sep 10, 2015 at 01:30:37PM +0200, Eduardo Morras wrote:
>>
>> Use gmake to compile.
>
> It didn't work either. Finally I've just installed some brand new linux
> on a nearby virtual machine, made there make -f Makefile.linux-gcc and
> thoroughly repeated it's output line-by-line on my FreeBSD while replacing
> gcc by cc. Eventually it compiled well (with almost the same set of warnings)
> and the result seems to work (at least within my own coverage).
>
> Thanks to the high general coding style, there were only two idiosyncrasies
> to be corrected: lack of the system-wide malloc.h (which is replaced by
> unistd.h in FreeBSD)

Perhaps I've missed something, but hasn't malloc.h been obsolete for
years now, with malloc() & friends being declared in stdlib.h as part
of standard C?

> and yet another lack of the fdatasync() syscall, which
> is already carefully screened from the sources by a special symbol called
> __ANDROID__ ;-)

--
Will

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: Native sqlite4 on FreeBSD

Eduardo Morras-2
In reply to this post by Valentin Davydov-2
On Fri, 11 Sep 2015 17:12:50 +0300
Valentin Davydov <[hidden email]> wrote:

> On Thu, Sep 10, 2015 at 01:30:37PM +0200, Eduardo Morras wrote:
> >
> > Use gmake to compile.
>
> It didn't work either. Finally I've just installed some brand new
> linux on a nearby virtual machine, made there make -f
> Makefile.linux-gcc and thoroughly repeated it's output line-by-line
> on my FreeBSD while replacing gcc by cc. Eventually it compiled well
> (with almost the same set of warnings) and the result seems to work
> (at least within my own coverage).
>
> Thanks to the high general coding style, there were only two
> idiosyncrasies to be corrected: lack of the system-wide malloc.h
> (which is replaced by unistd.h in FreeBSD) and yet another lack of
> the fdatasync() syscall, which is already carefully screened from the
> sources by a special symbol called __ANDROID__ ;-)

No, malloc.h is on libc stdlib.h

Fdatasync() syscall is linuxism and don't exist in FreeBSD, use fsync. Note that FreeBSD filesystem UFS2 softupdates takes care of separate metadata and data parts of a file write/update/delete.

> By the way, clang kindly revealed a couple of forgotten "unsigned" in
> the sources, which could (and did in the past) produce some nice
> bugs. Attention to developers.
>
> > Note that there isn't a port,
>
> I know. Despite the code being frozen for almost a full year, nobody
> wants to take a trouble of maintaining FreeBSD port (perhaps me too).

It's experimental code, I played with it before, but don't use on any project. A port has no sense for now, I think.
 
> Valentin Davydov.


---   ---
Eduardo Morras <[hidden email]>
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users