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 Database error with v11Beta2 #2555

Closed
hahnn opened this issue Dec 7, 2016 · 11 comments
Closed

PostgreSQL Database error with v11Beta2 #2555

hahnn opened this issue Dec 7, 2016 · 11 comments

Comments

@hahnn
Copy link

hahnn commented Dec 7, 2016

I tried to upgrade owncloud 9.1.2.5 to nextcloud 11Beta2 and after the upgrade I was unable to log in.
My database is under PostgreSQL (v 9.5).
I've seen a SQL error in my postgresql error log file which basically says that:

nextcloud is trying to insert what seems to be a boolean (with value 'f') in the remember column of table oc_authtoken. But in PostgreSQL, this column is defined with type smallint.

And PostgreSQL cannot insert boolean 'f' (for false I presume) in a smallint field and generates an error.

I manually updated the oc_authtoken table to set remember field as boolean instead of smallint, and nextcloud worked fine: no error anymore.

I suggest you update your PostgreSQL schema to have a boolean for the remember field of oc_authtoken table instead of a smallint, or as another workaround, you can keep this field as smallint but instead of inserting boolean values, then insert 0 or 1 values.

Server configuration

Operating system: CentOS 7.x with latest patches

Web server: Apache HTTPD 2.4.6-40

Database: PostgreSQL 9.5.5

PHP version: 7.0

Nextcloud version: (see Nextcloud admin page) 11 beta 2

Updated from an older Nextcloud/ownCloud or fresh install: upgraded from owncloud 9.1.2.5

Where did you install Nextcloud from: official archive on nextcloud web site

@LukasReschke
Copy link
Member

cc @icewind1991 @ChristophWurst

@LukasReschke
Copy link
Member

@hahnn
Copy link
Author

hahnn commented Dec 7, 2016

I add the log lines of my PostgreSQL server pointing to the error (this is in french but I think it can be understood with ease :-)):

2016-12-07 19:51:23.192 CET: ERREUR: syntaxe en entrée invalide pour l'entier : « f »
2016-12-07 19:51:23.192 CET: INSTRUCTION : INSERT INTO "oc_authtoken"("uid","login_name","password","name","token","type","remember","last_activity") VALUES($1,$2,$3,$4,$5,$6,$7,$8)

@hahnn
Copy link
Author

hahnn commented Dec 7, 2016

If I translate the error in english, this is something like:

ERROR: entry invalid syntax for integer: 'f'

@hahnn
Copy link
Author

hahnn commented Dec 7, 2016

I just checked the source code of nextcloud 11RC1 (db_structure.xml), and this code is exactly the same (for remember field of oc_authtoken table) than for nextcloud 11beta2.
So I believe the bug is also existing in nextcloud 11RC1, but I want to be clear I haven't tested this latest release candidate 1: only beta2.

@jospoortvliet
Copy link
Member

@hahnn then it looks like you'll get your shirt 👍

Any chance you could email me your address?

@hahnn
Copy link
Author

hahnn commented Dec 7, 2016

Well, yes, I will email you my address :-)
But have you confirmed this bug guys? Have you reproduced it wih 11RC1?

@icewind1991
Copy link
Member

I've had no issues like that on any of my postgres instances

@hahnn
Copy link
Author

hahnn commented Dec 7, 2016

In the process of making a fresh install of nextcloud 11RC1.
The oc_authtoken has just been created in my PostgreSQL server, and the remember field is still a smallint:

nextcloud=# \d oc_authtoken
Table « public.oc_authtoken »
Colonne | Type | Modificateurs
---------------+------------------------+---------------------------------------------------------------
id | integer | non NULL Par défaut, nextval('oc_authtoken_id_seq'::regclass)
uid | character varying(64) | non NULL Par défaut, ''::character varying
login_name | character varying(64) | non NULL Par défaut, ''::character varying
password | text |
name | text | non NULL Par défaut, ''::text
token | character varying(200) | non NULL Par défaut, ''::character varying
type | smallint | non NULL Par défaut, 0
remember | smallint | non NULL Par défaut, 0
last_activity | integer | non NULL Par défaut, 0
last_check | integer | non NULL Par défaut, 0
scope | text |
Index :
"oc_authtoken_pkey" PRIMARY KEY, btree (id)
"authtoken_token_index" UNIQUE, btree (token)
"authtoken_last_activity_index" btree (last_activity)

There is only the super user existing in my fresh nextcloud installation, and it has been inserted without any issue in the oc_authtoken table.
So in this case, the issue is not existing: there is no attempt to insert a boolean value in the remember field of the oc_authtoken table. Here this field contains the value 0.

Should I conclude that maybe this issue happens only in the case of an upgrade from owncloud to nextcloud?
Strange...

This is rising another question in my mind: is the core nextcloud the only one to deal with the oc_authtoken table, or is it possible that any other deployed app deal with this same table? Because in the case of my migration, we had a lot of apps deployed in owncloud. In such case, we might have a part of nextcloud or even an app dealing with the authtoken table the wrong way? Just wondering...

You guys should probably wait for confirmation of this behaviour in your lab, before to send me a shirt :-o

@nickvergessen
Copy link
Member

nickvergessen commented Dec 8, 2016

This was already fixed for the RC:
Duplicate of #2427 fixed in #2428

@jospoortvliet
Copy link
Member

@hahnn sorry, no t-shirt for you :(

Still thanks for reporting!

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

No branches or pull requests

5 participants