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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:52:09+00:00 2026-05-23T13:52:09+00:00

Related Link: String literals and escape characters in postgresql Here is my error: ERROR:

  • 0

Related Link:

  • String literals and escape characters in postgresql

Here is my error:

ERROR:  type "e" does not exist

Here is my query:

SELECT *
FROM dblink('host=theHostName port=1234 dbname=theDBName user=theUser password=thePassword',
    E'SELECT field_1, 
    CASE WHEN field_2 IS NOT NULL 
    THEN \'inactive\' ELSE \'active\' 
    END AS field_status 
    FROM the_table 
     ') 
AS linkresults(field_1 varchar(20),field_2 varchar(8))

If I use double quotes, remove the backslash escape for the single quotes and remove the E before the SELECT statement

SELECT *
FROM dblink('host=theHostName port=1234 dbname=theDBName user=theUser password=thePassword',
    "SELECT field_1, 
    CASE WHEN field_2 IS NOT NULL 
    THEN 'inactive' ELSE 'active' 
    END AS field_status 
    FROM the_table 
     ") 
AS linkresults(field_1 varchar(20),field_2 varchar(8))

I get this:

NOTICE:  identifier "SELECT ..." will be truncated

And the I also get the ERROR as my query has been truncated.

I have escaped with dblink like this before, so is there a server setting or something I need to configure?

I know the query works just fine if I run it on the sql server itself, but not with dblink. Any thoughts?

Postgres version 8.4

  • 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-23T13:52:10+00:00Added an answer on May 23, 2026 at 1:52 pm

    Try replacing \'inactive\' with ''inactive'' — caution: two single quotes

       SELECT *
        FROM dblink('host=theHostName port=1234 dbname=theDBName user=theUser password=thePassword',
            'SELECT field_1, 
            CASE WHEN field_2 IS NOT NULL 
            THEN ''inactive'' ELSE ''active'' 
            END AS field_status 
            FROM the_table 
             ') 
    
    AS linkresults(field_1 varchar(20),field_2 varchar(8))
    

    Alternative (previous) solution

       SELECT *
        FROM dblink('host=theHostName port=1234 dbname=theDBName user=theUser password=thePassword',
            'SELECT field_1, 
            CASE WHEN field_2 IS NOT NULL 
            THEN E\'inactive\' ELSE E\'active\' 
            END AS field_status 
            FROM the_table 
             ') 
    
    AS linkresults(field_1 varchar(20),field_2 varchar(8))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is related to my previous question Link The method bellow does excatly
Related to this question: URL characters replacement in JSP with UrlRewrite I want to
Related to: Query Windows Search from Java But this time to use OSX's spotlight
Related: see here I've got this command: exec((wget -O http://domain/file.zip && mysql -u user
I found that using String.substring is known for memory issues related to String.split .
I have a record edit link that GETs a 7 character alphanumeric text string
Since many PHP-related questions are very basic here, I'd propose to prepare a collection
UPDATE: Problem Solved. Darin Dimitrov's answer contains a link to another, related question. One
<link rel=stylesheet type=text/css href=../Content/Dashboard/CustomTooltip.css?v=<%= System.Diagnostics.FileVersionInfo.GetVersionInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).FileVersion %> /> Couple of questions: Is this an alright
(I am not familar with technologies related to HTML delivery, like JSP... But I

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.