The Schemaverse is a space-based strategy game implemented entirely within a PostgreSQL database. Compete against other players using raw SQL commands to command your fleet. Or, if your PL/pgSQL-foo is strong, wield it to write AI and have your fleet command itself!
The goal of the example below is to create a new ship & set its action with one query:
WITH new_ship as (
INSERT INTO my_ships(
name,
attack, defense, engineering, prospecting,
location,
action,
action_target_id
)
VALUES(
'Miner',
0,0,0,20,
(SELECT location FROM planets WHERE id = 5),
'MINE',
5
)
RETURNING id
)
SELECT
new_ship.id AS id,
UPGRADE( new_ship.id, 'PROSPECTING', 480) AS status
FROM new_ship
When executed, this query returns a success & create a ship, but DOES NOT set its action/action_target_id. This is a silent failure.
If possible, it would be great to get setting action/action_target_id working. Barring that, an error should be returned so that the client is aware of the issue.
The goal of the example below is to create a new ship & set its action with one query:
When executed, this query returns a success & create a ship, but DOES NOT set its action/action_target_id. This is a silent failure.
If possible, it would be great to get setting action/action_target_id working. Barring that, an error should be returned so that the client is aware of the issue.