473,383 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

ERROR: JOIN/USING types 'integer' and 'character varying' not matched

I had an error before involving a temporary table, and
that has been taken care of...
The last message I wrote where it seemed to have
needed it after I added it was because of different
\connects. Could someone please help me with this
next error as I'm importing to a new server?
I am getting quite a few of these...
CREATE VIEW care_plan_note_state AS
SELECT p.firm_id, p.patient_id, p.visit_id,
p.problem_id, p.patient_problem_id, p.note,
p."sequence", p.deleted, p.created, p.mo
dified, p.edited_by, p.inked, i.visit_id AS visit_in,
v.inked AS "_inked" FROM ((care_plan_note_history p
JOIN (SELECT vh.firm_id, v
h.patient_id, vh.visit_id, vh.discipline_id,
vh.person_id, vh.visit_type_id, vh.arrival, vh.depart,
vh.systolic, vh.diastolic, vh.we
ight, vh.temperature, vh.pulse, vh.respiration,
vh.progress_notes, vh.log, vh.inked, vh."sequence",
vh.deleted, vh.created, vh.modif
ied, vh.edited_by FROM visit_history vh WHERE
(vh."sequence" = (SELECT max(visit_history."sequence")
AS max FROM visit_history WHERE
(((vh.firm_id = visit_history.firm_id) AND
(vh.patient_id = visit_history.patient_id)) AND
(vh.visit_id = visit_history.visit_id)))
)) v USING (firm_id, patient_id, visit_id)) JOIN
care_plan_note_history i ON (((((((p.firm_id =
i.firm_id) AND (p.patient_id = i.pat
ient_id)) AND (p.visit_id = i.visit_id)) AND
(p.problem_id = i.problem_id)) AND
(p.patient_problem_id = i.patient_problem_id)) AND (
i."sequence" = 1)))) WHERE ((p."sequence" = (SELECT
max(care_plan_note_history."sequence") AS max FROM
care_plan_note_history WHERE
(((((care_plan_note_history.firm_id = p.firm_id) AND
(care_plan_note_history.patient_id = p.patient_id))
AND (care_plan_note_history
..visit_id = p.visit_id)) AND
(care_plan_note_history.problem_id = p.problem_id))
AND (care_plan_note_history.patient_problem_id = p.
patient_problem_id)))) AND (NOT ((p.deleted =
'1'::"varchar") AND (i.visit_id = p.visit_id))));
ERROR: JOIN/USING types 'integer' and 'character
varying' not matched

Thank you,
Mike

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 12 '05 #1
2 4535
On Thu, 2003-12-11 at 20:14, Michael . wrote:
I had an error before involving a temporary table, and
that has been taken care of...
The last message I wrote where it seemed to have
needed it after I added it was because of different
\connects. Could someone please help me with this
next error as I'm importing to a new server?
I am getting quite a few of these...
CREATE VIEW care_plan_note_state AS
SELECT p.firm_id, p.patient_id, p.visit_id,
p.problem_id, p.patient_problem_id, p.note,
p."sequence", p.deleted, p.created, p.mo
dified, p.edited_by, p.inked, i.visit_id AS visit_in,
v.inked AS "_inked" FROM ((care_plan_note_history p
JOIN (SELECT vh.firm_id, v
h.patient_id, vh.visit_id, vh.disci ....snip... ERROR: JOIN/USING types 'integer' and 'character
varying' not matched


I gave up on trying to follow all the nested brackets - I think you
would help both yourself and us if you formatted such a query!

I think the error means that you are joining on columns of differing
types. (E.g.: SELECT * FROM a JOIN b ON a.id = b.id, where a.id and
b.id are of different types.) That suggests an error in the query or a
discrepancy in the data structures; but if it is intentional, cast one
of them to match the other.

--
Oliver Elphick Ol************@lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"The spirit of the Lord GOD is upon me; because the
LORD hath anointed me to preach good tidings unto the
meek; he hath sent me to bind up the brokenhearted, to
proclaim liberty to the captives, and the opening of
the prison to them that are bound."
Isaiah 61:1
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #2
Oliver Elphick <ol**@lfix.co.uk> writes:
I think the error means that you are joining on columns of differing
types. (E.g.: SELECT * FROM a JOIN b ON a.id = b.id, where a.id and
b.id are of different types.)


More specifically, SELECT ... FROM a JOIN b USING (foo), where a.foo
and b.foo are of incompatible types. The result of the JOIN is supposed
to have just one merged column "foo", but Postgres can't figure out what
type to make that column.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rory Campbell-Lange | last post by:
I'm having troube doing a left outer self join on a table. The sent column shows the number of items sent to each recipient from each source. The received column (generated by the outer join) is...
5
by: Barbara Lindsey | last post by:
Thank you for your help on the trigger question. The RULE worked for most of the cases I had for this, but I have one that is giving me trouble. Here are my table definitions: CREATE SEQUENCE...
1
by: Jon Earle | last post by:
Hi, Had a problem with PsotgreSQL v7.3.4. I had a table that, after a while, decided to give me a fit: db=> insert into blocklist values ('2', 'km4n7s28ehiFizeYupm93Q', '1','2','3'); ERROR:...
0
by: Robert Stearns | last post by:
I am getting: SQL0408N A value is not compatible with the data type of its assignment target. Target name is "". SQLSTATE=42821 from the following statement: MERGE INTO is2.animals t1...
2
by: Doug Crowson | last post by:
I have some questions about co-located joins and db partitions. I've heard various things from various people and was looking for confirmation. Assume the following tables and partitioning keys:...
3
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records...
33
by: nkhan | last post by:
Need some help on this please: EECE1207 Spring 2005 Computer Assignment # 1 Due Wednesday, March 23rd The file ‘grades.txt’, as shown below, contains the results of a true-false exam...
8
by: Kevin Murphy | last post by:
Using PG 7.4.3 on Mac OS X 10.2.8, the following "insert into ... select ..." statement completed and then announced a syntax error, which seems bizarre. (Don't be confused by the fact that the...
0
by: Gary Townsend | last post by:
I am using Postgres 7.4.6 i have 3 tables i want to join 3 tables and return a list of route_id to which a specified user_id does NOT belong. Table "public.vts_users" Column | Type...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.