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 7769399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:09:01+00:00 2026-06-01T16:09:01+00:00

Really simple error when I’m creating some tables and it’s probably just me being

  • 0

Really simple error when I’m creating some tables and it’s probably just me being stupid but I’d rather post it here and have it sorted.

I’m using Postgresql.

(This table is just one of many but it’s the one that’s giving me a problem)

CREATE TABLE Ticket
(
    ID      INTEGER NOT NULL PRIMARY KEY,
    Problem VARCHAR(1000),
    Status  VARCHAR(20) NOT NULL DEFAULT 'open', 
    Priority    INTEGER NOT NULL,
    LoggedTime  TIMESTAMP NOT NULL,
    CustomerID  INTEGER NOT NULL,
    ProductID   INTEGER NOT NULL,
    FOREIGN KEY (ProductID) REFERENCES Product(ID),
    FOREIGN KEY (CustomerID) REFERENCES Customer(ID),
    CHECK (status='open' OR 'closed' AND priority =  1 OR 2 OR 3)
);

The error:

ERROR: invalid input syntax for type boolean: “closed”

Also if anybody can give me a better method of doing the CHECK:

CHECK (status='open' OR 'closed' AND priority =  1 OR 2 OR 3)

Then that would be really appreciated!

  • 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-06-01T16:09:02+00:00Added an answer on June 1, 2026 at 4:09 pm

    Use

    CHECK (Status IN ('open','closed') AND Priority IN (1,2,3))
    

    You could also use

    (Status ='open' OR  Status ='closed') AND
          (Priority =  1 OR Priority =  2 OR Priority =  3)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm probably making a really simple error somewhere, but for some reason the event
No doubt I'm missing something really simple here but I just can't see the
I am probably overlooking something really simple here but I am trying to redirect
Really simple question here but bugging me for long enough to ask. Code looks
This is probably a really simple jQuery question, but I couldn't answer it after
I've got a really simple rails question here but I can't seem to find
My question is really simple, but apparently nobody's experienced a similar error. I'm writing
I want to do something really simple but I get an error, what I'm
This is probably something really simple that I am blind to see, but the
This is probably really simple, but it's hindering me on my way down c++

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.