<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - (Correct) SQL-Query (wrongly) returns 0 (null) Values in specific Column. DBMS: PostgreSQL"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=118492">118492</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>(Correct) SQL-Query (wrongly) returns 0 (null) Values in specific Column. DBMS: PostgreSQL
</td>
</tr>
<tr>
<th>Product</th>
<td>LibreOffice
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0.3.2 release
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>Base
</td>
</tr>
<tr>
<th>Assignee</th>
<td>libreoffice-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>randmusr0@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Description:
Context: I'm working on setting up an anamnesis database for a medical
institution. My test-database needs to display certain disorders/diseases in
one table and associated risk situations in another.
Relevant Tables (if needed I can provide a graph of the database-design):
- hämo_erkrankung: id(int), lokalisation(int), person(int), zeitpunkt(date)
[eng: time of occurence]
FK: person -> person.id
lokalisation -> lokalisation.id
(one individual disease/disorder per row)
- situation: id(int), situation(varchar)
(one (risk-)situation per row)
- situation_p: id(int), hämo(int), situation(int)
FK: hämo -> hämo_erkrankung.id
situation -> situation.id
(n risk situations for one disease / disorder referenced by "hämo")
Problem: I wanted to create a Query displaying the actual situation associated
with a disease/disorder rather than the foreign key, using this SQL-Command:
SELECT "SP"."id", "SP"."hämo", "S"."situation"
FROM "situation_p" "SP", "situation" "S"
WHERE "SP"."situation" = "S"."id"
The desired result table is returned in Postgres (using the Terminal). However,
in Base the "S"."situation" column returns '0' in every row instead of the
referenced Varchar-Value from the situation table.
Since the Query works for the DBMS I cannot see that there is anything I can do
to make it work in Base. Therefore this might be a Base issue. Please let me
know if you think there is anything I did wrong.
Steps to Reproduce:
1. Use PostgreSQL as the DBMS
2. Create the tables and relationships (s. Description-section), add Data
3. Create the Query and run it (s. Description-section)
Actual Results:
Result-table using Base (see Description-section for Query)
[id, hämo, situation]
(1, 1, 0)
(2, 1, 0)
(3, 2, 0)
(4, 3, 0)
(.......)
Expected Results:
Result-table directly using PostgreSQL
[id, hämo, situation]
(1, 1, Körperliche Anstrengung)
(2, 1, Tamoxifen plus)
(3, 2, spontan)
(4, 3, Operation)
(.............)
Reproducible: Always
User Profile Reset: No
Additional Info:</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>