Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » Database Scheme(*.sch): Can two tables share a field with the same field name?
Database Scheme(*.sch): Can two tables share a field with the same field name? [message #23450] Tue, 20 October 2009 21:14 Go to next message
Lance is currently offline  Lance
Messages: 344
Registered: March 2007
Senior Member
DBMS is PostgreSQL.

db.sch
TABLE_(t_transaction)
  SERIAL_  (transaction_id) PRIMARY_KEY
  DATE_  (transaction_date)
  STRING_  (transaction_description, 200)
  INT_	(transaction_status)
  STRING_ (transaction_no, 10)
END_TABLE

 
TABLE_(t_entry)
  SERIAL_  (entry_id) PRIMARY_KEY
  INT_ (transaction_id) //REFERENCES_(t_transaction)
  BOOL_  (doc)
  INT_  (account_id)
  DOUBLE_ (amount)
END_TABLE


the INT_ (transaction_id) in the t_entry TABLE_ will make the program fail to compile. Do I need to put it to a separate *.sch files?

From reference/examples shipped with Upp, I know the PRIMARY_KEY can be all named ID without creating any problem.

Thanks for your help!
Re: Database Scheme(*.sch): Can two tables share a field with the same field name? [message #23453 is a reply to message #23450] Tue, 20 October 2009 22:08 Go to previous messageGo to next message
Zbych is currently offline  Zbych
Messages: 307
Registered: July 2009
Senior Member
Lance wrote on Tue, 20 October 2009 21:14

Do I need to put it to a separate *.sch files?


No, just remove undercore from INT_ in second table. It should look like this:
INT (transaction_id) REFERENCES(t_transaction(transaction_id) )

[Updated on: Tue, 20 October 2009 22:09]

Report message to a moderator

Re: Database Scheme(*.sch): Can two tables share a field with the same field name? [message #23469 is a reply to message #23450] Wed, 21 October 2009 15:25 Go to previous message
Lance is currently offline  Lance
Messages: 344
Registered: March 2007
Senior Member
Thank you. That fixed my problem.
Previous Topic: MSSQL access from Linux
Next Topic: SQLite Schema Bugfix
Goto Forum:
  


Current Time: Mon Apr 22 00:09:59 CEST 2019

Total time taken to generate the page: 0.00751 seconds