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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:05:37+00:00 2026-05-24T06:05:37+00:00

When I run the command: su -s /bin/bash -l postgres -c psql -d host

  • 0

When I run the command:

su -s /bin/bash -l postgres -c "psql -d host -c 'UPDATE version_table SET version_id='1.2' WHERE version_id=CAST ('1.1' AS character varying)'"

It worked well.

But if I changed the version_id to “1.2.1” as:

su -s /bin/bash -l postgres -c "psql -d host -c 'UPDATE version_table SET version_id='1.2.1' WHERE version_id=CAST ('1.1' AS character varying)'"

I got the following error messages:

ERROR:  syntax error at or near ".1"
LINE 1: ...M version_table WHERE version_id=CAST (1.2.1 AS char...

It seems more than one dot are not allowed.

How can I get around it?

Thank!

Add: the type of the column is character varying.

  • 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-24T06:05:39+00:00Added an answer on May 24, 2026 at 6:05 am

    You have fighting quotes. You’re using single quotes for the shell command:

    psql -d host -c '...sql...'
    

    And also for quoting strings inside the SQL:

    ... version_id='1.2' ...
    

    Try using double quotes for the shell part:

    psql -d host -c "UPDATE version_table SET version_id='1.2.1'  WHERE version_id=CAST ('1.1' AS character varying)"
    

    Or put the SQL in a separate text file and feed that to psql via the standard input

    psql -d host < sql_in_a_text_file.sql
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Bash script that builds a string to run as a command
I am using execv() to run commands from /bin/ such as 'ls', 'pwd', 'echo'
What is the difference between the following two commands, when run on AIX? /bin/sh
I'm obviously developing in debug mode. If I'm starting with the standard run command
To run a command on a single file, I recently realized I can do
I want to run a command as soon as a certain text appears in
How do I run this command with subprocess? I tried: proc = subprocess.Popen( '''ECHO
i want to run some command on several machine using ssh. I know it
I can run this command in SqlManager to detach the db ALTER DATABASE mydb
Trying to run the following command in php to run powershell command... the following

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.