Skip to content

DROP TAG

DROP TAG [IF EXISTS] <tag_name>

DROP TAG drops a tag with the given name in a graph space. You must have the DROP privilege for the graph space. To drop a tag in a specific graph space, you must use the graph space first.

NOTE: Before you drop a tag, make sure that the tag does not have any indexes. Otherwise, a conflict error ([ERROR (-8)]: Conflict!) is returned. To remove an index, see DROP INDEX.

A vertex can have one or more tags.

  • When a vertex has only one tag, after you drop it, the vertex CANNOT be accessible. But its edges are available. The vertex is deleted in the next compaction.
  • When a vertex has multiple tags, after you drop one of them, the vertex is still accessible. But all the properties defined by this dropped tag are not accessible.

This operation only deletes the Schema data. All the files and directories in the disk are NOT deleted directly. Data is deleted in the next compaction.

Tag name

  • IF EXISTS: Dropping a non-existent tag results in an error. You can use the IF EXISTS option to conditionally drop the tag and avoid the error.

    NOTE: The tag existence detection here compares only the tag names (excluding properties).

  • tag_name: Specifies the tag name that you want to drop. You can drop only one tag in one statement.

Example

nebula> CREATE TAG test(p1 string, p2 int);

nebula> DROP TAG test;

Last update: March 31, 2021
Back to top