Thread: Error in Adding All Tables
Hi freinds, i have a databank,which has 11 tables and i want to add them all togather. After Adding all tables, it shows me always this errors by debugging.
i need help from u ppl. I am using Visual C++ 2005 and postgresql 8.3. thanks
|
Run, Fatboy, Run" sowie "Rails & Ties" kostenlos anschauen! Blockbuster-Gutscheine sichern unter http://www.blockbuster.web.de |
salman Sheikh wrote: <blockquote cite="mid:1388732484@web.de" type="cite"><br /><br /><table id="alt" style="border-left:2px solid blue; padding-left: 10px; font-size: 9pt; margin-left: 20px; font-family: Verdana;"><tbody><tr><td><p>Hifreinds, <br /> i wanted to add my all tables once in MFC application,<p>i have a databank,whichhas 11 tables and i want to add them all togather.<p> After Adding all tables, it shows me always this errorsby debugging.<p><br /> ERROR: column reference "ctid" is ambiguous; <br /> Error while executing the query <br /><p>ineed help from u ppl. I am using Visual C++ 2005 and postgresql 8.3.<br /><p>thanks <br /> Sheikh <br /><br /><tableborder="0" cellpadding="0" cellspacing="0"><tbody><tr><td bgcolor="#000000"><img alt="" border="0" height="1" moz-do-not-send="true"src="https://img.web.de/p.gif" width="1" /></td></tr><tr><td style="font-size: 12px; font-family: verdana;">Psssst!Schon vom neuen WEB.DE MultiMessenger geh&oum l;rt? <br /> Der kann`s mit allen: <a href="http://www.produkte.web.de/messenger/?did=3123" moz-do-not-send="true"><b>http://www.produkte.web.de/messenger/?did=3123</b></a> </td></tr></tbody></table></td></tr></tbody></table><br /></blockquote><br/> Without looking at the sql statement you are using its kinda hard to know what the problem is<br /><br/> but ambiguous column means the Postgresql can't figure out what you want to do as the column shows up twice in acommand.<br /><br /><br />
I have no idea what you are trying to do?? please send the SQL commands you are using. For me to help you Need to know what you are trying to accomplish and need to see the code! salman Sheikh wrote: hi Do u have any suggestion regarding this problem? can u add all tables once in postgresql? In MS access i can add table once without any problem. sheikh <table id="alt" style="border-left: 2px solid blue; padding-left: 10px; font-size: 9pt; margin-left: 20px; font-family: Verdana;"> Von: "justin" <a class="moz-txt-link-rfc2396E" href="mailto:justin@emproshunts.com"><justin@emproshunts.com> Gesendet: 02.11.08 01:23:15 An: salman Sheikh CC: <a class="moz-txt-link-abbreviated" href="mailto:pgsql-general@postgresql.org">pgsql-general@postgresql.org, <a class="moz-txt-link-abbreviated" href="mailto:pgsql-odbc@postgresql.org">pgsql-odbc@postgresql.org Betreff: Re: [GENERAL] Error in Adding All Tables salman Sheikh wrote: <table id="alt" style="border-left: 2px solid blue; padding-left: 10px; font-size: 9pt; margin-left: 20px; font-family: Verdana;"> Hi freinds, i wanted to add my all tables once in MFC application, i have a databank,which has 11 tables and i want to a dd themall togather. After Adding all tables, it shows me always this errors bydebugging. ERROR: column reference "ctid" is ambiguous; Error while executing the query i need help from u ppl. I am using Visual C++ 2005 andpostgresql 8.3. thanks Sheikh <img moz-do-not-send="true" alt="" src="https://img.web.de/p.gif" border="0" height="1" width="1"> Psssst!Schon vom neuen WEB.DE MultiMessenger geh&oum l;rt? Der kann`s mit allen: <a moz-do-not-send="true" href="http://www.produkte.web.de/messenger/?did=3123">http://www.produkte.web.de/messenger/?did=3123 Without looking at the sql statement you are using its kinda hard toknow what the problem is but ambiguous column means the Postgresql can't figure o ut what youwant to do as the column shows up twice in a command. <img moz-do-not-send="true" src="https://img.web.de/p.gif" alt="" border="0" height="1" width="1"> <td style="font-family: verdana; font-size: 12px; line-height: 17px;">n 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! Nur 3,99 EUR/Monat! <a moz-do-not-send="true" href="http://www.maildomain.web.de/?mc=021114">http://www.maildomain.web.de/?mc=021114
<meta content="text/html;charset=ISO-8859-15" http-equiv="Content-Type"> you mean you are trying some kind of table joining correct??? example Select * from mytable, othertable where ctid = ctid ??? Please post the SQL statement you are using to communicate with the database. The select insert update commands. If i could see what you are doing i would have solved your problem 3 emails ago. just post the C++ code that has the problem salman Sheikh wrote: Hi i just want to add table through MFC application,in Visual C++ it generates all classes automatically,if i add table one by one,it shows no problem.i can comunicate with my database.But if i add 2 or more tables togather,then it shows this error, i dont know why? sheikh <table id="alt" style="border-left: 2px solid blue; padding-left: 10px; font-size: 9pt; margin-left: 20px; font-family: Verdana;"> Von: "justin" <justin@emproshunts.com> Gesendet: 02.11.08 01:48:04 An: pgsql-general-owner@postgresql.org Betreff: Re: [GENERAL] Error in Adding All Tables I have no idea what you are trying to do?? please send the SQLcommands you are using. For me to help you Need to know what you are trying to accomplish and need to see the code! salman Sheikh wrote: hi Do u ha ve any suggestion regarding this problem? can u add all tables once in postgresql? In MS access i can add table once without any problem. sheikh <table id="alt" style="border-left: 2px solid blue; padding-left: 10px; font-size: 9pt; margin-left: 20px; font-family: Verdana;"> Von: "justin" <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:justin@emproshunts.com"><justin@emproshunts.com> Gesendet: 02.11.08 01:23:15 An: salman Sheikh CC: <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:pgsql-general@postgresql.org">pgsql-general@postgresql.org,<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:pgsql-odbc@postgresql.org">pgsql-odbc@postgresql.org Betreff: Re: [GENERAL] Error in Adding All Tables @WEB.DE> salman Sheikh wrote: <table id="alt" style="border-left: 2px solid blue; padding-left: 10px; font-size: 9pt; margin-left: 20px;"> Hi freinds, i wanted to add my all tables once in MFC application, i have a databank,which has 11 tables and i want toa dd themall togather. After Adding all tables, it shows me always thiserrors bydebugging. ERROR: column reference "ctid" is ambiguous; Error while executing the query i need help from u ppl. I am using Visual C++ 2005andpostgresql 8.3. thanks Sheikh <table border="0" cellpadding="0" cellspacing="0"> <img moz-do-not-send="true" alt="" src="https://img.web.de/p.gif" border="0" height="1" width="1"> <td style="font-size: 12px; font-family: verdana;">Psssst!Schonvom neuen WEB.DE MultiMessenger geh&oum l;rt? Der kann`s mit allen: <a moz-do-not-send="true" href="http://www.produkte.web.de/messenger/?did=3123">http://www.produkte.web.de/messenger/?did=3123 Without looking at the sql statement you are using its kinda hardtoknow what the problem is but ambiguous column means the Postgresql can't figure o ut whatyouwant to do as the column shows up twice in a command. <img moz-do-not-send="true" alt="" src="https://img.web.de/p.gif" border="0" height="1" width="1"> <td style="font-size: 12px; line-height: 17px; font-family: verdana;">n 5Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! Nur 3,99 EUR/Monat! <a moz-do-not-send="true" href="http://www.maildomain.web.de/?mc=021114">http://www.maildomain.web.de/?mc=021114 <img moz-do-not-send="true" src="https://img.web.de/p.gif" alt="" border="0" height="1" width="1"> er WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! <a moz-do-not-send="true" href="http://smartsurfer.web.de/?mc=100071&distributionid=000000000066">http://smartsurfer.web.de/?mc=100071&distributionid=000000000066
salman Sheikh wrote: > > > Hi freinds, > i wanted to add my all tables once in MFC application, > > i have a databank,which has 11 tables and i want to add them all togather. > > After Adding all tables, it shows me always this errors by debugging. > > > ERROR: column reference "ctid" is ambiguous; > Error while executing the query This means you did this: SELECT ctid,ctid from table1, table2 But it doesn't know which ctid belongs to which table. You need to use aliases or dotted notation. Joshua D. Drake
<meta content="text/html;charset=ISO-8859-15" http-equiv="Content-Type"> Yes, i'm working with VS 2008 with QT framework working on a application with i don't know couple hundred thousand lines of code. Been using VS sense 1997 how about you??? One of your big problems is your using the Automatic Class builder. Its sucks and is what is causing your problem as it creates code that don't work. Case in point the SQL code is wrong. In this case the Select statement being created is trying to join two tables together that have the same column name Select * from mytable, othertable where ctid = ctid this command will create the error you have now to avoid the error it should look like this Select * from mytable, othertable where mytable.ctid = othertable.ctid Now Postgresql knows what you want it to do. Before the Postgresql has two columns with the same name and does not understand how to join the two tables Find the the code where the Select statement is change the Joining argument salman Sheikh wrote: Hi Justin thanks for helping me, But can i ask u ,have u ever worked with Visual C++ 2005.It does every thing automatically,u just click on the button it will generats all classes, for example View class, document class Set class and so on,Set class is actually connection class,which connect application with database, and shows all columns of the table which we added in this application,thatwhy i dont need to write any sql code for adding all table,how long i know,if i am wrong pls correct me. thanks once more Jusitn sheikh <table id="alt" style="border-left: 2px solid blue; padding-left: 10px; font-size: 9pt; margin-left: 20px; font-family: Verdana;"> Von: "justin" <justin@emproshunts.com> Gesendet: 02.11.08 02:02:21 An: pgsql-general@postgresql.org Betreff: Re: [GENERAL] Error in Adding All Tables you mean you are trying some kind of table joining correct??? example Select * from mytable, othertable where ctid = ctid ??? Please post the SQL statement you are using to communicate with thedatabase. The select insert update commands. If i could see what you are doingi would have solved your problem 3 emails ago. just post the C++ code that has the problem salman Sheikh wrote: Hi i just want to add table through MFC application,in Visual C++ itgenerates all classes automatically,if i add table one by one,it showsno problem.i can comunicate with my database.But if i add 2 or moretables togather,then it shows this error, i dont know why? sheikh <table id="alt" style="border-left: 2px solid blue; padding-left: 10px; font-size: 9pt; margin-left: 20px; font-family: Verdana;"> Von: "justin" <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:justin@emproshunts.com"><justi n@emproshunts.com> Gesendet: 02.11.08 01:48:04 An: <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:pgsql-general-owner@postgresql.org">pgsql-general-owner@postgresql.org Betreff: Re: [GENERAL] Error in Adding All Tables I have no idea what you are trying to do?? please send theSQLcommands you are using. For me to help you Need to know what you are trying to accomplish and need to see the code! salman Sheikh wrote: hi Do u ha ve any suggestion regarding this problem? can u add all tables once in postgresql? In MS access i can add table once without any problem. sheikh <table id="alt" style="border-left: 2px solid blue; padding-left: 10px; font-size: 9pt; margin-left: 20px; font-family: Verdana;"> Von: "justin" <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:justin@emproshunts.com"><justin@emproshunts.com>< /A> Gesendet: 02.11.08 01:23:15 An: salman Sheikh CC: <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:pgsql-general@postgresql.org">pgsql-general@postgresql.org,<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:pgsql-odbc@postgresql.org">pgsql-odbc@postgresql.org Betreff: Re: [GENERAL] Error in Adding All Tables @WEB.DE> salman Sheikh wrote: <table id="alt" style="border-left: 2px solid blue; padding-left: 10px; font-size: 9pt; margin-left: 20px;"> Hi freinds, i wanted to add my all tables once in MFC application, i have a databank,which has 11 tables and iwant toa dd themall togather. After Adding all tables, it shows me alwaysthiserrors bydebugging. ERROR: column reference "ctid" is ambiguous; Error while executing the query i need help from u ppl. I am using VisualC++ 2005andpostgresql 8.3. thanks She ikh <table border="0" cellpadding="0" cellspacing="0"> <img moz-do-not-send="true" alt="" src="https://img.web.de/p.gif" border="0" height="1" width="1"> <td style="font-size: 12px; font-family: verdana;">Psssst!Schonvom neuenWEB.DE MultiMessenger geh&oum l;rt? Der kann`s mit allen: <a moz-do-not-send="true" href="http://www.produkte.web.de/messenger/?did=3123">http://www.produkte.web.de/messenger/?did=3123 Without looking at the sql statement you are using its kinda hardtoknowwhat the problem is but ambiguous column means the Postgresql can't figure o ut whatyouwantto do as the column shows up twice in a command. <img moz-do-not-send="true" alt="" src="https://img.web.de/p.gif" border="0" height="1" width="1"> <td style="font-size: 12px; font-family: verdana;">n5Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! Nur 3,99 EUR/Monat! <a moz-do-not-send="true" href="http://www.maildomain.web.de/?mc=021114">http://www.maildomain.web.de/?mc=021114 <img moz-do-not-send="true" alt="" src="https://img.web.de/p.gif" border="0" height="1" width="1"> er WEB.DESmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! <a moz-do-not-send="true" href="http://smartsurfer.web.de/?mc=100071&distributionid=000000000066">http://smartsurfer.web.de/?mc=100071&distributionid=000000000066 <img moz-do-not-send="true" src="https://img.web.de/p%0A%20.gif" alt="" border="0" height="1" width="1"> <td style="font-family: verdana; font-size: 12px; line-height: 17px;">n 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! Nur 3,99 EUR/Monat! <a moz-do-not-send="true" href="http://www.maildomain.web.de/?mc=021114">http://www.maildomain.web.de/?mc=021114
Exactly NO not a clue. Do a crtl+F which brings up the Search box in Visual Studio search for Select. it will be in one of automatically created .cpp files.
Class builder is suppose to create fully qualified queries but in some cases it does not
mshelpfile <http://msdn.microsoft.com/en-us/library/s9ds2ktb%28VS.80%29.aspx>
the command will look something like
DatabaseConnectionObject.ExecuteSql= "Select column1, column2, column3 column4 from Mytable Left Join Othertable on ctid = ctid ".
it needs to look like this
DatabaseConnectionObject.ExecuteSql = "Select column1, column2, column3 column4 from Mytable Left Join Othertable on OtherTable.ctid = MyTable.ctid "
One method that is used by a number people is make sure columns in tables never share the same name. one way is use the first 3 letters of a table followed by an underscore then name of the column example ( oth_citd and myt_ctid) This way one never has to worry typing fully qualified names.
This is a method i use when setting up tables.
I strongly suggest learning SQL syntax. If you can wrap your mind around C++ and its quirks you can very quickly learn SQL
Also you will need to learn
http://www.postgresql.org/docs/current/static/plpgsql.html
its very easy to pick up also and write complicated stored procedures to manipulated data
Also take note what qualifies as SQL command in Access sometimes will not work in Postgresql
Another thought is not use ODBC at all and use
libpq <http://www.postgresql.org/docs/8.3/interactive/libpq.html> there more work involved.
salman Sheikh wrote:
Class builder is suppose to create fully qualified queries but in some cases it does not
mshelpfile <http://msdn.microsoft.com/en-us/library/s9ds2ktb%28VS.80%29.aspx>
the command will look something like
DatabaseConnectionObject.ExecuteSql= "Select column1, column2, column3 column4 from Mytable Left Join Othertable on ctid = ctid ".
it needs to look like this
DatabaseConnectionObject.ExecuteSql = "Select column1, column2, column3 column4 from Mytable Left Join Othertable on OtherTable.ctid = MyTable.ctid "
One method that is used by a number people is make sure columns in tables never share the same name. one way is use the first 3 letters of a table followed by an underscore then name of the column example ( oth_citd and myt_ctid) This way one never has to worry typing fully qualified names.
This is a method i use when setting up tables.
I strongly suggest learning SQL syntax. If you can wrap your mind around C++ and its quirks you can very quickly learn SQL
Also you will need to learn
http://www.postgresql.org/docs/current/static/plpgsql.html
its very easy to pick up also and write complicated stored procedures to manipulated data
Also take note what qualifies as SQL command in Access sometimes will not work in Postgresql
Another thought is not use ODBC at all and use
libpq <http://www.postgresql.org/docs/8.3/interactive/libpq.html> there more work involved.
salman Sheikh wrote:
HI justin
actually i am newbie in this field,thatwhy i dont have much knowledge it. Now i understand the problem,but i am using MFC classes,as i told u it generates automatically, do u have any idea where should i change the code?
i am very thankful to you man
sheikh
------------------------------------------------------------------------
*Von:* "justin" <justin@emproshunts.com>
*Gesendet:* 02.11.08 02:34:44
*An:* pgsql-general@postgresql.org
*Betreff:* Re: [GENERAL] Error in Adding All Tables
Yes, i'm working with VS 2008 with QT framework working on aapplication with i don't know couple hundred thousand lines of code.
Been using VS sense 1997 how about you???
One of your big problems is your using the Automatic Class builder. Its sucks and is what is causing you r problem as it creates code thatdon't work.
Case in point the SQL code is wrong.
In this case the Select statement being created is trying to join twotables together that have the same column name
Select * from mytable, othertable where ctid = ctid
this command will create the error you have
now to avoid the error it should look like this
Select * from mytable, othertable where mytable.ctid = othertable.ctid
Now Postgresql knows what you want it to do. Before the Postgresql hastwo columns with the same name and does not understand how to join thetwo tables
Find the the code where the Select statement is change the Joiningargument
salman Sheikh wrote:
Hi Justin
thanks for helping me,
But can i ask u ,have u ever worked with Visual C++ 2005.It
doesevery thing automatically,u just click on the button it will
generatsall classes, for example View class, document class Set
class and soon,Set class is actually connection class,which
connect applicationwith database, and shows all columns of the
table which we added inthis application,thatwhy i dont need to
write any sql code for addingall table,how long i know,if i am
wrong pls correct me.
thanks once more Jusitn
sheikh
------------------------------------------------------------------------
*Von:* "justin" <justin@emproshunts.com>
*Gesendet:* 02.11.08 02:02:21
*An:* pgsql-general@postgresql.org
*Betreff:* Re: [GENERAL] Error in Adding All Tables
you mean you are trying some kind of table joining correct???
example
Select * from mytable, othertable where ctid = ctid ???
Please post the SQL statement you are using to communicate
withthedatabase. The select insert update commands. If i could see what you are
doingiwould have solved your problem 3 emails ago.
just post the C++ code that has the problem
salman Sheikh wrote:
Hi
i just want to add table through MFC application,in VisualC++
itgenerates all classes automatically,if i add table one by
one,itshowsno problem.i can comunicate with my database.But if
i add 2 ormoretables togather,then it shows this error, i dont
know why?
sheikh
------------------------------------------------------------------------
*Von:* "justin" <justin@emproshunts.com>
*Gesendet:* 02.11.08 01:48:04
*An:* pgsql-general-owner@postgresql.org
*Betreff:* Re: [GENERAL] Error in Adding All Tables
I have no idea what you are trying to do?? pleasesend
theSQLcommands you are using.
For me to help you
Need to know what you are trying to accomplish and need to see
the code!
salman Sheikh wrote:
hi
Do u ha ve any suggestion regarding this problem?
can u add all tables once in postgresql?
In MS access i can add table once without anyproblem.
sheikh
------------------------------------------------------------------------
*Von:* "justin" <justin@emproshunts.com></A>
*Gesendet:* 02.11.08 01:23:15
*An:* salman Sheikh
*CC:* pgsql-general@postgresql.org,pgsql-odbc@postgresql.org
*Betreff:* Re: [GENERAL] Error in AddingAll Tables
@WEB.DE>
salman Sheikh wrote:
Hi freinds,
i wanted to add my all tables once in MFC application,
i have a databank,which has 11tables and iwant toa
dd themall togather.
After Adding all tables, it showsme alwaysthiserrors
bydebugging.
ERROR: column reference "ctid" is ambiguous;
Error while executing the query
i need help from u ppl. I am usingVisualC++
2005andpostgresql 8.3.
thanks
She ikh
Psssst!SchonvomneuenWEB.DE MultiMessenger geh&oum
l;rt? Der kann`s mit allen:
*http://www.produkte.web.de/messenger/?did=3123*
Without looking at the sql statement you are using its
kindahardtoknowwhat the problem is
but ambiguous column means the Postgresql can't figure o
utwhatyouwantto do as the column shows up twice in a command.
n5Schritten zur eigenenHomepage. Jetzt Domain sichern und
gestalten! Nur 3,99 EUR/Monat!
*http://www.maildomain.web.de/?mc=021114*
<htt%0A%20p://www.maildomain.web.de/?mc=021114>
erWEB.DESmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu
sparen! *http://smartsurfer.web.de/?mc=100071&distributionid=000000000066*
<http://smartsurfer.web.de/?mc=100071&distributionid=000000000066>
n 5Schritten zur eigenen Homepa ge. Jetzt Domain sichern und
gestalten! Nur 3,99 EUR/Monat! *http://www.maildomain.web.de/?mc=021114*
n 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! Nur 3,99 EUR/Monat! *http://www.maildomain.web.de/?mc=021114*
Joshua D. Drake <jd@commandprompt.com> schrieb: > salman Sheikh wrote: >> >> >> Hi freinds, >> i wanted to add my all tables once in MFC application, >> >> i have a databank,which has 11 tables and i want to add them all togather. >> >> After Adding all tables, it shows me always this errors by debugging. >> >> >> ERROR: column reference "ctid" is ambiguous; >> Error while executing the query > > This means you did this: > > SELECT ctid,ctid from table1, table2 > > But it doesn't know which ctid belongs to which table. You need to use > aliases or dotted notation. For the example above, for instance: select a.ctid, b.ctid from table1 a, table2 b ... (if you want this columns) Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°