---
title: detach_tablespaces() | Tiger Data Docs
description: Detach all tablespaces from a hypertable
---

Since [0.7.0](https://github.com/timescale/timescaledb/releases/tag/0.7.0)

Detach all tablespaces from a hypertable. After issuing this command on a hypertable, it no longer has any tablespaces attached to it. New chunks are instead placed in the database’s default tablespace.

## Samples

Detach all tablespaces from the hypertable `conditions`:

```
SELECT detach_tablespaces('conditions');
```

## Arguments

The syntax is:

```
SELECT detach_tablespaces(
    hypertable = '<hypertable_name>'
);
```

| Name         | Type     | Default | Required | Description                               |
| ------------ | -------- | ------- | -------- | ----------------------------------------- |
| `hypertable` | REGCLASS | -       | ✔        | Hypertable to detach the tablespace from. |

## Returns

| Name                | Type    | Description                                                             |
| ------------------- | ------- | ----------------------------------------------------------------------- |
| detach\_tablespaces | INTEGER | The total number of tablespaces that were detached from the hypertable. |
