Re: Implicit cast of literal in SQL statements

From: Thomas Lockhart <lockhart(at)fourpalms(dot)org>
To: Scott Royston <scroyston71(at)yahoo(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Implicit cast of literal in SQL statements
Date: 2001-12-27 21:28:53
Message-ID: 3C2B9295.91DD8559@fourpalms.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

> I've seen a few postings in multiple newsgroups saying that in 7.1.x and
> up, literals in SQL statements are implicitly cast to strings.

In some contexts, that statement is true, yes. The cases where this is
true is when the parser is trying to match literals with available
function calls. If there is a literal of unknown type, and if there is a
function which could take a string literal as input, then that function
is the one chosen.

> does this really work for everybody else? Can someone point me to a
> compile flag I may be missing, or the code that actually does the
> implicit cast?

It looks like we are not handling the case where there is no explicit
function call, and there a string literal in the target list (so no
underlying column to infer a type from), and there is a subsequent
ordering operation. That might be fixable, but it may not be a useful
real world example afaict.

Do you have another example to illustrate the problem for a query which
one might actually need to use?

- Thomas

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Scott Royston 2001-12-27 22:28:29 Re: Implicit cast of literal in SQL statements
Previous Message Tom Lane 2001-12-27 21:22:56 Re: Implicit cast of literal in SQL statements

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2001-12-27 21:32:18 Re: TODO question
Previous Message Tom Lane 2001-12-27 21:22:56 Re: Implicit cast of literal in SQL statements