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

  • Home
  • SEARCH
  • 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 806623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:16:20+00:00 2026-05-15T00:16:20+00:00

I have a query SELECT assetid, type_code, version, name, short_name, status, languages, charset, force_secure,

  • 0

I have a query

SELECT assetid, type_code, version, name, short_name, status, languages,
charset, force_secure, created, created_userid, updated, updated_userid,
published, published_userid, status_changed, status_changed_userid
FROM sq_ast WHERE assetid = 7

which doesn’t work and throws

ERROR: operator does not exist: character varying = integer LINE 4: FROM sq_ast WHERE assetid = 7

I can get it to work by doing

SELECT assetid, type_code, version, name, short_name, status, languages,
charset, force_secure, created, created_userid, updated, updated_userid,
published, published_userid, status_changed, status_changed_userid
FROM sq_ast WHERE assetid = '7'

Please note the quoting of the 7 in the WHERE clause…

I am deploying an huge application and I cannot rewrite the core… similarly I don’t want to risk changing the type of the column…

I’m no Postgres expert… please help…

Is there an option for strict casting of columns???

  • 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-15T00:16:21+00:00Added an answer on May 15, 2026 at 12:16 am

    Postgresql is more strongly typed in recent versions, and that’s a good thing. If assetid is VARCHAR, then you can’t compare it to an integer (since 8.4, I believe).

    In general (not only in Postgresql, not only in database design) it’s bad design to mix those types: numeric datatypes should be used for real numeric fields, and not for strings that just happen to consist of digits.

    For example, an invoice “number”, or a credit card “number”, should not normally be represented as “number”, but as a string.

    Sometimes, however, the decision is not clear (eg: document numbers).

    Some criteria that can help:

    • Are you potentially interested in doing arithmetic with your values (sum, substract)? Would that at least make sense? Then, it’s an number.

    • Should zeroes on the left be preserved, or considered relevant? (is ’07’ to be regarded as different from ‘7’?) Then, it is a string.

    Depending on how you anwser these questions in your scenario (Is there an assetid that begins with 0? Could there be some non numeric character? Does it seem to be an serial number ?), you might consider to change the field type or (more probable in your scenario) to do a cast, in the prefered direction:

       SELECT... FROM sq_ast WHERE assetid::integer = 7
    

    (if you decide that the field is numeric) or elsewhere

       SELECT... FROM sq_ast WHERE assetid = '7'
    

    There’s no global setting for reverting to the old behaviour, and force an implicit cast for character types, AFAIK.

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

Sidebar

Ask A Question

Stats

  • Questions 539k
  • Answers 539k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can just use this, it refers to the clicked… May 17, 2026 at 2:15 am
  • Editorial Team
    Editorial Team added an answer You need to create an instance of ApplesTestDrive, not Apples.… May 17, 2026 at 2:15 am
  • Editorial Team
    Editorial Team added an answer I'd argue that you should build a separate "diverse" admin… May 17, 2026 at 2:15 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a query select * from table where name in ('52 T&M', '60
I wanna to have query: Select cars.* from cars where cars.code in ( select
Given this Hibernate snippet @org.hibernate.annotations.NamedQueries({ @org.hibernate.annotations.NamedQuery( name = ASSIGNED_CONTINGENCIES, query = select ctg.id from
I have this query: SELECT * FROM table WHERE key LIKE '1,2,3,%' OR key
I have this query SELECT id, timeOrdered, order_desc, firstname, lastname FROM `db`.`myTable` WHERE `myTable`.`customer_number`
I have the query... SELECT COUNT(order_id) as orders, SUM(order_total) as sales FROM uc_orders WHERE
Imagine we have a query: SELECT * FROM somewhere WHERE `id` IN(1,5,18,25) ORDER BY
Access 2007 / SQL / VB I have a query: SELECT Count(*) AS CountOfCR1
suppose i have a query $array = array(); $sql = mysql_query(SELECT * FROM table);
Ok, so I have a query: select distinct(a) from mytable where b in (0,3)

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.