Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6844637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:24:09+00:00 2026-05-27T00:24:09+00:00

I have this weird problem. I have defined a column in a SQLite database

  • 0

I have this weird problem. I have defined a column in a SQLite database as STRING but when I use it with integers prefixed by a + it automatically converts them to a proper integer:

sqlite> create table test (key STRING);
sqlite> insert into test values ('+1'); 
sqlite> insert into test values ("+2");
sqlite> select * from test;
1
2

As you can see the + sign is removed. On the other hand, if I quote the strings twice:

sqlite> delete from test;
sqlite> insert into test values ('"+3"');
sqlite> insert into test values ("'+4'");
"+3"
'+4'

… it works as expected but they are quoted. My primary problem is that I need to “double quote” all strings because I cannot guarantee that some string might look like an integer to the database and therefore be tampered with.

This is what I would like to know:

  • Why does SQLite behave like this (and maybe other implementations)?
  • Can I do something about it? (Without the double quoting?)

Just for reference, inserting the string '+test' works as expected:

sqlite> delete from test;
sqlite> insert into test values ('+t');
sqlite> select * from test;
+t

(answer without quotes – whiii!)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:24:10+00:00Added an answer on May 27, 2026 at 12:24 am

    This is related to SQLite’s dynamic data typing. In particular, STRING is not a valid type, so SQLite defaults it to NUMERIC affinity. In fact, to quote from that page:

    Note that a declared type of “FLOATING POINT” would give INTEGER
    affinity, not REAL affinity, due to the “INT” at the end of “POINT”.
    And the declared type of “STRING” has an affinity of NUMERIC, not
    TEXT.

    You want to declare your column as TEXT, not STRING. That will fix it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is kind of a weird problem, but I have to create a search
This may seem weird but I have a problem in one of my programs
Weird problem in Django with forms : I have a Form.class defined like this
I have this weird problem with setting up cookies with PHP. Everything worked fine
This is a weird problem I have started having recently. My team is developing
This is a really weird problem that I have been having. When I download
I have a weird problem, and I don't know if this is the default
I have a weird problem. I am trying to setup User Defined Runtime Attribute
I have a weird problem with deferred binding. I have defined the following module:
So I have this weird looking problem: my very basic program generates an error

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.