quantified-uncertainty / metaforecast

Fetch forecasts from prediction markets/forecasting platforms to make them searchable. Integrate these forecasts into other services.
https://metaforecast.org/
MIT License
57 stars 5 forks source link

What is `INSERT INTO latest.frontpage(frontpage_full, frontpage_sliced) VALUES($1, $2)` doing, in `src/backend/frontpage.ts`? #20

Closed NunoSempere closed 2 years ago

NunoSempere commented 2 years ago

I don't get what this line is doing, and the Postgres documentation isn't much help.

In particular, I'm confused by inserting two tables into another table. Just pointing me to some documentation on this is fine.

berekuk commented 2 years ago

It just adds a new row to the frontpage table. frontpage_full and frontpage_sliced are not tables, but column names (see pgInitializeFrontpage code).

It means that the table will grow indefinitely, but I tried to reproduce the old behavior which kept each version in the log.

Maybe that's excessive, though, and maintaining a single row table with upserts would be enough, what do you think?

NunoSempere commented 2 years ago

Thanks, didn't realize that these were json objects. A single row table with upserts does feel like enough.