func (s *StoragePostgres) tagExists(tx *sql.Tx, parentTagID int, name string) (ok bool, err error) {
	var cnt int
	err = tx.QueryRow(`
		SELECT COUNT(t.id)
			FROM tag_names n
			JOIN tags t ON n.tag_id = t.id
			WHERE t.parent_id = $1 and n.name = $2
	`, parentTagID, name,
	).Scan(&cnt)
	if err != nil {
		return false, hh.MakeInternalServerError(
			errors.Annotatef(
				err,
				"checking whether tag %q already exists under the parent %d",
				name, parentTagID,
			),
		)
	}

	return cnt > 0, nil
}
// tagExists returns whether the tag with the given name already exists under
// the given parent tag.
tagExists returns whether the tag with the given name already exists under
the given parent tag.
// tagExists returns whether the tag with the given name already exists under // the given parent tag .
func (s *StoragePostgres) tagExists(tx *sql.Tx, parentTagID int, name string) (ok bool, err error) {
	var cnt int
	err = tx.QueryRow(`
		SELECT COUNT(t.id)
			FROM tag_names n
			JOIN tags t ON n.tag_id = t.id
			WHERE t.parent_id = $1 and n.name = $2
	`, parentTagID, name,
	).Scan(&cnt)
	if err != nil {
		return false, hh.MakeInternalServerError(
			errors.Annotatef(
				err,
				"checking whether tag %q already exists under the parent %d",
				name, parentTagID,
			),
		)
	}
	return cnt > 0, nil
}
func ( s * StoragePostgres ) tagExists ( tx * sql . Tx , parentTagID int , name string ) ( ok bool , err error ) { var cnt int err = tx . QueryRow ( `
		SELECT COUNT(t.id)
			FROM tag_names n
			JOIN tags t ON n.tag_id = t.id
			WHERE t.parent_id = $1 and n.name = $2
	` , parentTagID , name , ) . Scan ( & cnt ) if err != nil { return false , hh . MakeInternalServerError ( errors . Annotatef ( err , " " , name , parentTagID , ) , ) } return cnt > 0 , nil }
tagExists returns whether the tag with the given name already exists under
the given parent tag.
tagExists returns whether the tag with the given name already exists under the given parent tag .