Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL support in at least rss.py #621

Closed
Yuubari opened this issue Sep 21, 2014 · 2 comments
Closed

PostgreSQL support in at least rss.py #621

Yuubari opened this issue Sep 21, 2014 · 2 comments

Comments

@Yuubari
Copy link

Yuubari commented Sep 21, 2014

Reference: https://github.com/embolalia/willie/blob/master/willie/modules/rss.py#L67

PostgreSQL does not define tinyint and bool.

PostgreSQL defines boolean (mostly according to SQL:1999 standard with the exception of UNKNOWN value support), but “default 1” is incorrect syntax for a boolean column; accepted are literals like “default '1'”:

xiatest=# create table test1 (a boolean default 1, b text);
ERROR:  column "a" is of type boolean but default expression is of type integer
HINT:  You will need to rewrite or cast the expression.

xiatest=# create table test1 (a boolean default '1', b text);
CREATE TABLE

Valid literal values for the "true" state are: TRUE, 't', 'true', 'y', 'yes', 'on', '1'.
For the "false" state, the following values can be used: FALSE, 'f', 'false', 'n', 'no', 'off', '0'.

Reference: http://www.postgresql.org/docs/9.3/static/datatype-boolean.html

Judging by MySQL's so-called implementation (BOOL and BOOLEAN are aliases for TINYINT) and the way this column is used in the module, an integer type should suffice. Quoting,

BOOL, BOOLEAN
These types are synonyms for TINYINT(1). A value of zero is considered false. Nonzero values are considered true.
…the values TRUE and FALSE are merely aliases for 1 and 0, respectively…

Reference: http://dev.mysql.com/doc/refman/5.7/en/numeric-type-overview.html

Presently I'm using

c.execute('''CREATE TABLE IF NOT EXISTS rss_feeds (
    channel TEXT,
    feed_name TEXT,
    feed_url TEXT,
    fg SMALLINT,
    bg SMALLINT,
    enabled SMALLINT DEFAULT 1,
    article_title TEXT,
    article_url TEXT,
    published TEXT,
    etag TEXT,
    modified TEXT,
    PRIMARY KEY {0}
    )'''.format(primary_key))

which seems to work fine.

@tyrope
Copy link

tyrope commented Sep 21, 2014

@embolalia Stated in the development channel that starting with Willie5 we'll only support SQLite.

@embolalia
Copy link
Contributor

@tyrope correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants