# FreeBSD An exception occurred while executing 'INSERT INTO "oc\_calendars"

**URL:** <https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574>\
**Category:** ℹ️ Support\
**Tags:** freebsd, nc13\
**Created:** [April 19, 2018, 8:29am UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574 "2018-04-19T08:29:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon55335978](https://help.nextcloud.com/letter_avatar/anon55335978/32/6_449c533f586939b6e5f246632a46421f.png) [@anon55335978](https://help.nextcloud.com/u/anon55335978)\
**Post date:** [April 19, 2018, 8:29am UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574/1 "2018-04-19T08:29:28Z")

</div>

Good day  
I have been fighting this for a couple of days now. I have tried the FreeBSD repositories for contact calendar and addressbook downloading directly and cli. Nextcloud postgreql php are run in the same jail.

uname -a  
FreeBSD nextcloud.local 11.1-RELEASE-p8 FreeBSD 11.1-RELEASE-p8

```
pkg info nextcloud
nextcloud-13.0.1
Name : nextcloud
Version : 13.0.1
Installed on : Wed Apr 18 11:00:59 2018 EDT
Origin : www/nextcloud
Architecture : FreeBSD:11:*
Prefix : /usr/local
Categories : www
Licenses : AGPLv3
Maintainer : brnrd@FreeBSD.org
WWW : https://nextcloud.com
Comment : Personal cloud which runs on your own server
Options :
        EXIF : on
        LDAP : on
        MYSQL : off
        OPCACHE : on
        PGSQL : on
        SMB : on
        SQLITE : off
        SSL : on
Annotations :
        cpe : cpe:2.3:a:nextcloud:nextcloud:13.0.1:::::freebsd11:x64

```

`# sudo -u www php occ dav:create-calendar admin calendar`

```
  [Doctrine\DBAL\Exception\TableNotFoundException]
  An exception occurred while executing 'INSERT INTO "oc_calendars" ("principaluri", "uri", "synctoken", "transparent", "components", "displayname") VALUES(?, ?, ?
  , ?, ?, ?)' with params ["principals\/users\/admin", "calendar", 1, 0, "VEVENT,VTODO", "calendar"]:
  SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "oc_calendars" does not exist
  LINE 1: INSERT INTO "oc_calendars" ("principaluri", "uri", "synctoke...
                      ^
  [Doctrine\DBAL\Driver\PDOException]
  SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "oc_calendars" does not exist
  LINE 1: INSERT INTO "oc_calendars" ("principaluri", "uri", "synctoke...
                      ^
  [PDOException]
  SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "oc_calendars" does not exist
  LINE 1: INSERT INTO "oc_calendars" ("principaluri", "uri", "synctoke...
                      ^

```

dav:create-calendar

```
 pkg info postgresql10-server
postgresql10-server-10.3_1
Name : postgresql10-server
Version : 10.3_1
Installed on : Wed Apr 18 10:49:53 2018 EDT
Origin : databases/postgresql10-server
Architecture : FreeBSD:11:amd64
Prefix : /usr/local
Categories : databases
Licenses : PostgreSQL
Maintainer : pgsql@FreeBSD.org
WWW : http://www.postgresql.org/
Comment : PostgreSQL is the most advanced open-source database available anywhere
Options :
        DEBUG : off
        DTRACE : off
        GSSAPI : off
        INTDATE : on
        LDAP : off
        NLS : on
        OPTIMIZED_CFLAGS: off
        PAM : off
        SSL : on
        TZDATA : on
        XML : on
Shared Libs required:
        libicui18n.so.61
        libintl.so.8
        libpq.so.5
        libicuuc.so.61
        libxml2.so.2
Annotations :
        FreeBSD_version: 1101001
        cpe : cpe:2.3:a:postgresql:postgresql:10.3:::::freebsd11:x64:1
        repo_type : binary
        repository : FreeBSD
Flat size : 19.7MiB

sudo -u www php /usr/local/www/nextcloud/occ config:list system
{
    "system": {
        "instanceid": " ***REMOVED SENSITIVE VALUE***",
        "passwordsalt": " ***REMOVED SENSITIVE VALUE***",
        "secret": " ***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "10.0.0.204",
            "nextcloud.local",
            "local"
        ],
        "datadirectory": " ***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/10.0.0.204",
        "dbtype": "pgsql",
        "version": "13.0.1.1",
        "dbname": " ***REMOVED SENSITIVE VALUE***",
        "dbhost": " ***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": " ***REMOVED SENSITIVE VALUE***",
        "dbpassword": " ***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "log_type": "file",
        "logfile": "\/var\/log\/nextcloud.log",
        "loglevel": "0",
        "logdateformat": "F d, Y H:i:s",
        "logtimezone": "America\/Toronto",
        "log_rotate_size": 52428800,
        "memcache.local": "\\OC\\Memcache\\Memcached",
        "memcache.distributed": "\\OC\\Memcache\\Memcached",
        "memcached_servers": [
            [
                "10.0.0.204",
                11211
            ]
        ],
        "appstoreenabled": true,
        "apps_paths": [
            {
                "path": "\/usr\/local\/www\/nextcloud\/apps",
                "url": "\/apps",
                "writable": true
            },
            {
                "path": "\/usr\/local\/www\/nextcloud\/apps-pkg",
                "url": "\/apps-pkg",
                "writable": false
            }
        ],
        "defaultapp": "calendar",
        "mail_smtpmode": "smtp",
        "mail_domain": " ***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": " ***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": 25,
        "mail_smtptimeout": 30,
        "mail_smtpsecure": "",
        "mail_smtpauth": true,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpname": " ***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": " ***REMOVED SENSITIVE VALUE***",
        "updatechecker": false,
        "check_for_working_webdav": true,
        "check_for_working_wellknown_setup": true,
        "enable_previews": true,
        "preview_max_x": 4096,
        "preview_max_y": 4096,
        "preview_libreoffice_path": "\/usr\/local\/bin\/libreoffice",
        "enabledPreviewProviders": [
            "OC\\Preview\\PNG",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\GIF",
            "OC\\Preview\\BMP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\MP3",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MarkDown"
        ],
        "maintenance": false,
        "cache_path": "\/var\/db\/nextcloud\/data\/",
        "max_filesize_animated_gifs_public_sharing": 50
    }
}

```

Thanks for looking

---

<div class="post-metadata">

**Author:** ![gorby](https://help.nextcloud.com/user_avatar/help.nextcloud.com/gorby/32/8820_2.png) [@gorby](https://help.nextcloud.com/u/gorby)\
**Post date:** [April 21, 2018, 12:03am UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574/2 "2018-04-21T00:03:20Z")

</div>

Hi Geoinsbay,

Same issue here.  
Don’t know where to look… can’t find any information nowhere.

Did you manage to fix it ?

–  
Léo.

---

<div class="post-metadata">

**Author:** ![gorby](https://help.nextcloud.com/user_avatar/help.nextcloud.com/gorby/32/8820_2.png) [@gorby](https://help.nextcloud.com/u/gorby)\
**Post date:** [April 21, 2018, 12:05am UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574/3 "2018-04-21T00:05:19Z")

</div>

Additional info :

```
> [root@xxx /usr/local/www/nextcloud]# sudo -u www php occ maintenance:repair
> [...]
> [Doctrine\DBAL\Exception\TableNotFoundException]
> An exception occurred while executing 'UPDATE `oc_calendars` SET `components` = ? WHERE `uri` = ?' with params ["VEVENT", "contact_birthdays"]:
> SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_calendars' doesn't exist
> 
> [Doctrine\DBAL\Driver\PDOException]
> SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_calendars' doesn't exist
> 
> [PDOException]
> SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_calendars' doesn't exist

```

Seems like something wrong with the table creation process…

–  
Léo.

---

<div class="post-metadata">

**Author:** ![gorby](https://help.nextcloud.com/user_avatar/help.nextcloud.com/gorby/32/8820_2.png) [@gorby](https://help.nextcloud.com/u/gorby)\
**Post date:** [April 21, 2018, 9:46am UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574/4 "2018-04-21T09:46:17Z")

</div>

Hi again,

For those having the same issue, I managed to fix this bug by going to the nextcloud root directory, and type :  
`sudo -u www php occ app:enable dav`  
or  
`sudo -u www-data php occ app:enable dav`  
… depending on your server config.

Cheers,

–  
Léo.

---

<div class="post-metadata">

**Author:** ![anon55335978](https://help.nextcloud.com/letter_avatar/anon55335978/32/6_449c533f586939b6e5f246632a46421f.png) [@anon55335978](https://help.nextcloud.com/u/anon55335978)\
**Post date:** [April 21, 2018, 11:42am UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574/5 "2018-04-21T11:42:10Z")

</div>

Good Day  
I did not set up /var/log/postgresql.log for this run The third time doing this today There a lot of lines to screw up, but I think I got most of the previous fat finger itess under control

Keep gettimg the same errors So something is wrong

# Technical information

The following list covers which files have failed the integrity check. Please read  
the previous linked documentation to learn more about the errors and how to fix  
them.

# Results

- core
  - EXTRA\_FILE
    - file.

# Raw output

Array  
(  
[core] =\> Array  
(  
[EXTRA\_FILE] =\> Array  
(  
[file.] =\> Array  
(  
[expected] =\>  
[current] =\> ff9f010b5bdd7591d052fdb8cfc6e7b842f8f973ab37a91ea5e16449c17e9278d9f95f265b0508f083348376aeb16d7f02b7b86cde634e8c9f875287049360de  
)

```
            )

    )

```

)  
sudo -u www php occ maintenance:repair

- Repair MySQL collation
  - Not a mysql database -\> nothing to do

- Repair mime types
- Clean tags and favorites
  - 0 tags of deleted users have been removed.
  - 0 tags for delete files have been removed.
  - 0 tag entries for deleted tags have been removed.
  - 0 tags with no entries have been removed.

- Repair invalid shares
- Remove shares of a users root folder
- Move .step file of updater to backup location
- Add move avatar background job
  - Repair step already executed

- Add preview cleanup background jobs
- Fix potential broken mount points
  - No mounts updated

- Repair language codes
- Install new core bundle components
- Repair invalid paths in file cache
- Rename folder with user specific keys
- Add log rotate job
- Clear frontend caches
  - Image cache cleared
  - SCSS cache cleared
  - JS cache cleared

- Fix component of birthday calendars

[Doctrine\DBAL\Exception\TableNotFoundException]  
An exception occurred while executing ‘UPDATE “oc\_calendars” SET “components” = ? WHERE “uri” = ?’ with params [“VEVENT”, “contact\_birthdays”]:  
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation “oc\_calendars” does not exist  
LINE 1: UPDATE “oc\_calendars” SET “components” = $1 WHERE “uri” = $2  
^

[Doctrine\DBAL\Driver\PDOException]  
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation “oc\_calendars” does not exist  
LINE 1: UPDATE “oc\_calendars” SET “components” = $1 WHERE “uri” = $2  
^

[PDOException]  
SQLSTATE[42P01]: Undefined table: 7 ERROR: relation “oc\_calendars” does not exist  
LINE 1: UPDATE “oc\_calendars” SET “components” = $1 WHERE “uri” = $2  
^  
Postgresql setup

# su postgres

psql  
psql (10.3)  
Type “help” for help.  
postgres=# CREATE USER nextcloud WITH PASSWORD ‘{NEXTCLOUD\_DB\_PASSWORD}’;  
CREATE ROLE  
postgres=# CREATE DATABASE nextcloud TEMPLATE template0 ENCODING ‘UNICODE’;  
CREATE DATABASE  
postgres=#CREATE DATABASE nextcloud TEMPLATE template0 ENCODING ‘UNICODE’;  
ALTER DATABASE  
postgres=#GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;  
postgres-# \q

/var/log messages  
Apr 20 18:18:12 nextcloud postgres[57405]: [8-1] 2018-04-20 18:18:12.257 EDT [57405] FATAL: role “root” does not exist  
Apr 20 20:46:57 nextcloud postgres[44565]: [8-1] 2018-04-20 20:46:57.519 EDT [44565] ERROR: relation “oc\_calendars” does not exist at character 8  
Apr 20 20:46:57 nextcloud postgres[44565]: [8-2] 2018-04-20 20:46:57.519 EDT [44565] STATEMENT: UPDATE “oc\_calendars” SET “components” = $1 WHERE “uri” = $2  
Apr 20 20:53:24 nextcloud postgres[97523]: [8-1] 2018-04-20 20:53:24.669 EDT [97523] ERROR: relation “oc\_calendars” does not exist at character 159  
Apr 20 20:53:24 nextcloud postgres[97523]: [8-2] 2018-04-20 20:53:24.669 EDT [97523] STATEMENT: SELECT “displayname”, “description”, “timezone”, “calendarorder”, “ca  
lendarcolor”, “id”, “uri”, “synctoken”, “components”, “principaluri”, “transparent” FROM “oc\_calendars” WHERE “principaluri” = $1 ORDER BY “calendarorder” ASC  
Apr 20 20:53:53 nextcloud postgres[4746]: [8-1] 2018-04-20 20:53:53.221 EDT [4746] ERROR: relation “oc\_calendars” does not exist at character 159  
Apr 20 20:53:53 nextcloud postgres[4746]: [8-2] 2018-04-20 20:53:53.221 EDT [4746] STATEMENT: SELECT “displayname”, “description”, “timezone”, “calendarorder”, “cale  
ndarcolor”, “id”, “uri”, “synctoken”, “components”, “principaluri”, “transparent” FROM “oc\_calendars” WHERE “principaluri” = $1 ORDER BY “calendarorder” ASC  
Apr 20 20:57:14 nextcloud postgres[75146]: [8-1] 2018-04-20 20:57:14.968 EDT [75146] ERROR: relation “oc\_calendars” does not exist at character 8  
Apr 20 20:57:14 nextcloud postgres[75146]: [8-2] 2018-04-20 20:57:14.968 EDT [75146] STATEMENT: UPDATE “oc\_calendars” SET “components” = $1 WHERE “uri” = $2

---

<div class="post-metadata">

**Author:** ![tflidd](https://help.nextcloud.com/letter_avatar/tflidd/32/6_449c533f586939b6e5f246632a46421f.png) [@tflidd](https://help.nextcloud.com/u/tflidd)\
**Post date:** [April 21, 2018, 11:48am UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574/6 "2018-04-21T11:48:46Z")

</div>

The question is why don’t you have a calendar table in the first place. Did you try to enable and disable the calendar app?

Did you do a fresh install of NC13 or something update from a previous version or migrated from ownCloud?

---

<div class="post-metadata">

**Author:** ![anon55335978](https://help.nextcloud.com/letter_avatar/anon55335978/32/6_449c533f586939b6e5f246632a46421f.png) [@anon55335978](https://help.nextcloud.com/u/anon55335978)\
**Post date:** [April 21, 2018, 9:14pm UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574/7 "2018-04-21T21:14:29Z")

</div>

@tflidd This is a fresh install in a jail on a Freebsd 11.1 p8 server. The last error messages was just after booting into the admin account for the first time. I saw the core array error and ran sudo -u www php occ maintenance:repair Which gave the above mentioned following errors. This is my sixth or seven try in the last week to get this to work. Failed so far. Postgresql 10 seems to connect but things seem to fail after that. I am not sure where “FATAL: role “root” does not exist” is coming from. As side note I do have another postgresql9.6 instance running in another jail and I have enabled raw\_sockets on both jails

```
 # cat /etc/jail.conf
nextcloud {
  host.hostname = nextcloud.local;
  jid = 4;
  ip4.addr = 10.0.0.204;
  interface = igb0;
  path = /jails/nextcloud;
  allow.raw_sockets;
  sysvsem = new;
  sysvshm = new;
  sysvmsg = new;
}

```

I tried installing calendar, contacts and addressbook through FreeBSD port system, via pkg and the app store but has no effect.

So I am at a lost as to why to why it is not connecting.

Sorry about the formatting, I very rarely participate on forums, I read a lot on them, so formatting skills here are not good  
Thank you for the reply

---

<div class="post-metadata">

**Author:** ![anon55335978](https://help.nextcloud.com/letter_avatar/anon55335978/32/6_449c533f586939b6e5f246632a46421f.png) [@anon55335978](https://help.nextcloud.com/u/anon55335978)\
**Post date:** [April 21, 2018, 11:24pm UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574/8 "2018-04-21T23:24:07Z")

</div>

@gorby  
Thank you Thank you Thank you

`sudo -u www php occ app:enable dav`

worked like a charm

and no complaints from

sudo -u www php occ maintenance:repair

And calendars actually seem to work

Progress that is wonderful

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [September 23, 2024, 6:08pm UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574/9 "2024-09-23T18:08:37Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 9, 2024, 2:36pm UTC](https://help.nextcloud.com/t/freebsd-an-exception-occurred-while-executing-insert-into-oc-calendars/30574/10 "2024-12-09T14:36:48Z")

</div>


